Skip to content

Commit cd73fdf

Browse files
committed
Resolve #15
1 parent 486e477 commit cd73fdf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: libgravatar/__init__.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,12 @@ def md5_hash(string):
249249
'0bc83cb571cd1c50ba6f3e8a78ef1346'
250250
251251
"""
252-
return md5(string.encode("utf-8")).hexdigest()
252+
try:
253+
# On security-restricted systems, indicate we are fingerprinting only:
254+
return md5(string.encode("utf-8"), usedforsecurity=False).hexdigest()
255+
except TypeError:
256+
# On systems without usedforsecurity:
257+
return md5(string.encode("utf-8")).hexdigest()
253258

254259

255260
def default_url_is_valid(url):

0 commit comments

Comments
 (0)