Skip to content

Commit

Permalink
removed sha1/md5 import in favor of hashlib
Browse files Browse the repository at this point in the history
  • Loading branch information
yed authored and trbs committed Feb 27, 2010
1 parent 9a93358 commit 0e35ffb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions django_extensions/utils/uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,8 @@ def uuid1(node=None, clock_seq=None):

def uuid3(namespace, name):
"""Generate a UUID from the MD5 hash of a namespace UUID and a name."""
import md5
hash = md5.md5(namespace.bytes + name).digest()
from hashlib import md5
hash = md5(namespace.bytes + name).digest()
return UUID(bytes=hash[:16], version=3)

def uuid4():
Expand All @@ -529,8 +529,8 @@ def uuid4():

def uuid5(namespace, name):
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
import sha
hash = sha.sha(namespace.bytes + name).digest()
from hashlib import sha1
hash = sha1(namespace.bytes + name).digest()
return UUID(bytes=hash[:16], version=5)

# The following standard UUIDs are for use with uuid3() or uuid5().
Expand Down

0 comments on commit 0e35ffb

Please sign in to comment.