summaryrefslogtreecommitdiffstats
path: root/Doc/includes/sqlite3/md5func.py
blob: 0056b2d6ce84efb927d1e391ab61bcf367c1cd0e (plain)
1
2
3
4
5
6
7
8
9
10
11
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()
cur.execute("select md5(?)", (b"foo",))
print(cur.fetchone()[0])