Gitiles
Code Review
Sign In
gerrit-public.fairphone.software
/
platform
/
external
/
python
/
cpython3
/
724b828e7941ab801769a09b1d494cc4d9ffda3b
/
.
/
Doc
/
includes
/
sqlite3
/
md5func.py
blob: 0056b2d6ce84efb927d1e391ab61bcf367c1cd0e [
file
] [
log
] [
blame
]
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
])