shithub: riscv

ref: 81c9ede53f6f9ebd67e7134e664c98e08b9fcca6
dir: /sys/src/cmd/python/Doc/lib/sqlite3/md5func.py/

View raw version
import sqlite3
import md5

def md5sum(t):
    return md5.md5(t).hexdigest()

con = sqlite3.connect(":memory:")
con.create_function("md5", 1, md5sum)
cur = con.cursor()
cur.execute("select md5(?)", ("foo",))
print cur.fetchone()[0]