MCPcopy Index your code
hub / github.com/python/cpython / uuid5

Function uuid5

Lib/uuid.py:782–791  ·  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

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

Callers

nothing calls this directly

Calls 2

_from_intMethod · 0.80
digestMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…