On this page
uuid.uuid5
Prev: uuid.uuid4 | Up: uuid | Next: uuid.uuid6
Rel: uuid.bytes_, uuid.Enum, uuid.getnode, uuid.int_
Ref: docs.python.org — uuid.uuid5
Tags: #public #python3 #stdlib #uuid
Import
import uuid
from uuid import uuid5
Signature & Overview
uuid.uuid5(namespace, name)
Generate a UUID from the SHA-1 hash of a namespace UUID and a name.
Usage
import uuid
u = uuid.uuid5(uuid.NAMESPACE_URL, 'https://example.com')
assert u.version == 5 and u == uuid.uuid5(uuid.NAMESPACE_URL, 'https://example.com')
Gotchas
- Best deterministic UUID: Same
(namespace, name)always produces the exact same UUID across machines.
REPL Inspect
from uuid import uuid5
help(uuid5)
Linked from
Related notes
- tuts/python3/stdlib_module/uuid/uuid4 Linked here; links to this page; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/uuid6 Linked here; links to this page; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/bytes_ Linked here; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/Enum Linked here; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/getnode Linked here; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/int_ Linked here; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/UUID Linked here; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/uuid/main shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/SafeUUID shared tags: #stdlib, #uuid