Skip to content

Commit cff86e9

Browse files
committed
remove rationale comment for HACL* MD5
In this commit, we move the rationale for using HACL*-based MD5 instead of its OpenSSL implementation from the code to this note. HACL*-based MD5 is 2x faster than its OpenSSL implementation for creating the hash object via `h = md5(..., usedforsecurity=False)` but `h.digest()` is slightly (yet noticeably) slower. Overall, HACL*-based MD5 still remains faster than its OpenSSL-based implementation, whence the choice of `_md5.md5` over `hashlib.md5`.
1 parent c1ffa7d commit cff86e9

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

Lib/uuid.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,6 @@ def uuid3(namespace, name):
728728
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
729729
if isinstance(name, str):
730730
name = bytes(name, "utf-8")
731-
# HACL*-based MD5 is slightly faster than its OpenSSL version,
732-
# and 'import X; X.Y' is slightly faster than 'from X import Y'.
733731
import _md5
734732
h = _md5.md5(namespace.bytes + name, usedforsecurity=False)
735733
assert len(h.digest()) == 16

0 commit comments

Comments
 (0)