Generate a UUID from the SHA-1 hash of a namespace UUID and a name.
(namespace, name)
| 779 | return UUID._from_int(int_uuid_4) |
| 780 | |
| 781 | def 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 |
nothing calls this directly
no test coverage detected