1import sqlite3
2import hashlib
3
4def md5sum(t):
5    return hashlib.md5(t).hexdigest()
6
7con = sqlite3.connect(":memory:")
8con.create_function("md5", 1, md5sum)
9cur = con.cursor()
10cur.execute("select md5(?)", (b"foo",))
11print(cur.fetchone()[0])
12