-
Notifications
You must be signed in to change notification settings - Fork 581
Limit md5 import to allow for compatibility with fips environments #1288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ | |
| from collections import defaultdict | ||
| from collections.abc import Mapping | ||
| from functools import total_ordering | ||
| from hashlib import md5 | ||
| import hashlib | ||
| import json | ||
| import logging | ||
| import re | ||
|
|
@@ -1864,7 +1864,7 @@ class MD5Token(HashToken): | |
| def hash_fn(cls, key): | ||
| if isinstance(key, str): | ||
| key = key.encode('UTF-8') | ||
| return abs(varint_unpack(md5(key).digest())) | ||
| return abs(varint_unpack(hashlib.md5(key,usedforsecurity=False).digest())) | ||
|
lratc marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
| class BytesToken(Token): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would prefer we keep the narrow import scope on a security librarry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I have changed the approach to use a similar pattern to the one used for murmur3 (I inverted the if logic to avoid nesting the if statements).