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