diff options
author | Guido van Rossum <guido@python.org> | 2007-07-09 14:29:40 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-07-09 14:29:40 (GMT) |
commit | 5ed033b5a21d56db0dbb0b2535b83afd5cad143d (patch) | |
tree | c71f90134e631b26ffe0507c139c3b070266c832 /Lib/uuid.py | |
parent | 867bcbcd6d7b251a2cd8a01ce70fdbc1dba6f029 (diff) | |
download | cpython-5ed033b5a21d56db0dbb0b2535b83afd5cad143d.zip cpython-5ed033b5a21d56db0dbb0b2535b83afd5cad143d.tar.gz cpython-5ed033b5a21d56db0dbb0b2535b83afd5cad143d.tar.bz2 |
Change hashlib to return bytes from digest() instead of str8.
Diffstat (limited to 'Lib/uuid.py')
-rw-r--r-- | Lib/uuid.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py index 51b44f8..30154f0 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -528,7 +528,7 @@ def uuid3(namespace, name): """Generate a UUID from the MD5 hash of a namespace UUID and a name.""" from hashlib import md5 hash = md5(namespace.bytes + bytes(name, "utf-8")).digest() - return UUID(bytes=bytes_(hash[:16]), version=3) + return UUID(bytes=hash[:16], version=3) def uuid4(): """Generate a random UUID.""" @@ -551,7 +551,7 @@ def uuid5(namespace, name): """Generate a UUID from the SHA-1 hash of a namespace UUID and a name.""" from hashlib import sha1 hash = sha1(namespace.bytes + bytes(name, "utf-8")).digest() - return UUID(bytes=bytes_(hash[:16]), version=5) + return UUID(bytes=hash[:16], version=5) # The following standard UUIDs are for use with uuid3() or uuid5(). |