Menu

Which UUID Should You Generate: v4, v1, or a Name-Based v3/v5?
📰

Which UUID Should You Generate: v4, v1, or a Name-Based v3/v5?

DEV Community: tutorial·Muhammad Wasim·3 days ago
#k3YcDA3i
#devtotutorial#devto#dev#uuid#generate
Reading 0:00
15s threshold

Most applications need identifiers that will not clash, even when two machines create records at the same time without asking a central database for the next integer. That is what a UUID is for: a 128-bit value you can generate independently.

The default choice is usually a random v4 . The other versions exist for cases where you want time-ordering, or a value you can recreate from a name.

Versions this generator supports

The UUID Generator on ToolSphare follows RFC 4122 and can produce versions 1, 3, 4 and 5 . The page itself summarises them:

v1 — time-based, with a clock sequence and node

v3 — name-based, using MD5

v4 — random (most common)

v5 — name-based, using SHA-1

For v3 and v5 you also choose a namespace — DNS , URL , OID , X.500 DN , or a custom UUID — and a name (the field defaults to example.com ).…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.