diff options
-rw-r--r-- | ipalib/ipauuid.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ipalib/ipauuid.py b/ipalib/ipauuid.py index 19b8415f..25bd70aa 100644 --- a/ipalib/ipauuid.py +++ b/ipalib/ipauuid.py @@ -529,8 +529,11 @@ 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() + try: + from hashlib import md5 + except ImportError: + from md5 import md5 + hash = md5(namespace.bytes + name).digest() return UUID(bytes=hash[:16], version=3) def uuid4(): |