blob: 16dc348bf001e261cdce2a8ca00331609168c498 [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])
Xtreak287b84d2019-05-20 03:22:20 +053012
13con.close()