Skip to content

Commit

Permalink
Merge pull request #10 from samuelraudabaugh/patch-1
Browse files Browse the repository at this point in the history
Add usedforsecurity to md5 constructor
  • Loading branch information
ZeroCool940711 authored Jan 3, 2024
2 parents 9767f58 + 21295a5 commit 95b81f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/whoosh/filedb/filetables.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
D. J. Bernstein's CDB format (http://cr.yp.to/cdb.html).
"""

import os, struct
import os, struct, sys
from binascii import crc32
from hashlib import md5 # @UnresolvedImport

Expand All @@ -56,7 +56,9 @@ def cdb_hash(key):


def md5_hash(key):
return int(md5(key).hexdigest(), 16) & 0xffffffff
if sys.version_info[0] < 3 or sys.version_info[1] < 9:
return int(md5(key).hexdigest(), 16) & 0xffffffff
return int(md5(key, usedforsecurity=False).hexdigest(), 16) & 0xffffffff


def crc_hash(key):
Expand Down

0 comments on commit 95b81f8

Please sign in to comment.