MCPcopy Index your code
hub / github.com/RustPython/RustPython / uuid5

Function uuid5

Lib/uuid.py:781–790  ·  view source on GitHub ↗

Generate a UUID from the SHA-1 hash of a namespace UUID and a name.

(namespace, name)

Source from the content-addressed store, hash-verified

779 return UUID._from_int(int_uuid_4)
780
781def uuid5(namespace, name):
782 """Generate a UUID from the SHA-1 hash of a namespace UUID and a name."""
783 if isinstance(name, str):
784 name = bytes(name, "utf-8")
785 import hashlib
786 h = hashlib.sha1(namespace.bytes + name, usedforsecurity=False)
787 int_uuid_5 = int.from_bytes(h.digest()[:16])
788 int_uuid_5 &= _RFC_4122_CLEARFLAGS_MASK
789 int_uuid_5 |= _RFC_4122_VERSION_5_FLAGS
790 return UUID._from_int(int_uuid_5)
791
792
793_last_timestamp_v6 = None

Callers

nothing calls this directly

Calls 5

isinstanceFunction · 0.85
_from_intMethod · 0.80
sha1Method · 0.45
from_bytesMethod · 0.45
digestMethod · 0.45

Tested by

no test coverage detected