blob: 0056b2d6ce84efb927d1e391ab61bcf367c1cd0e [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001import 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()
Petri Lehtinen1ca93952012-02-15 22:17:21 +020010cur.execute("select md5(?)", (b"foo",))
Georg Brandl116aa622007-08-15 14:28:22 +000011print(cur.fetchone()[0])