2007-08-15 11:28:22 -03:00
|
|
|
import sqlite3
|
|
|
|
import hashlib
|
|
|
|
|
|
|
|
def md5sum(t):
|
|
|
|
return hashlib.md5(t).hexdigest()
|
|
|
|
|
|
|
|
con = sqlite3.connect(":memory:")
|
|
|
|
con.create_function("md5", 1, md5sum)
|
|
|
|
cur = con.cursor()
|
2012-02-15 16:17:21 -04:00
|
|
|
cur.execute("select md5(?)", (b"foo",))
|
2007-08-15 11:28:22 -03:00
|
|
|
print(cur.fetchone()[0])
|