Gitiles
Code Review
Sign In
gerrit-public.fairphone.software
/
platform
/
external
/
python
/
cpython3
/
23cbd8a6564df0ac3df339f91196c45f3e626d32
/
.
/
Doc
/
includes
/
sqlite3
/
md5func.py
blob: b7bc05b379da79af60b2cbf63a44c3ecf2f6aa5a [
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(?)"
,
(
"foo"
,))
print
(
cur
.
fetchone
()[
0
])