mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
Fix deprecation error importing sha
This commit is contained in:
parent
069763c5c6
commit
2779da3096
@ -555,8 +555,11 @@ def uuid4():
|
|||||||
|
|
||||||
def uuid5(namespace, name):
|
def uuid5(namespace, name):
|
||||||
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
|
"""Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
|
||||||
import sha
|
try:
|
||||||
hash = sha.sha(namespace.bytes + name).digest()
|
from hashlib import sha1 as sha
|
||||||
|
except ImportError:
|
||||||
|
from sha import sha
|
||||||
|
hash = sha(namespace.bytes + name).digest()
|
||||||
return UUID(bytes=hash[:16], version=5)
|
return UUID(bytes=hash[:16], version=5)
|
||||||
|
|
||||||
# The following standard UUIDs are for use with uuid3() or uuid5().
|
# The following standard UUIDs are for use with uuid3() or uuid5().
|
||||||
|
Loading…
Reference in New Issue
Block a user