❯serpapisget_key()

$ man guid-generator

GUID Generator

NAME

guid-generator — Generate UUID v4 and sortable UUID v7 identifiers in bulk from the browser's cryptographic random source. Formatting options and a UUID inspector included.

SYNOPSIS

# What is a GUID generator?
A GUID generator produces globally unique identifiers — 128-bit values written as 32 hexadecimal digits in five hyphenated groups — that any machine can create independently without coordination and still not collide.

WHY HERE

Developer utilities for people building with APIs.

./guid-generator --interactive

Loading the GUID Generator…

USAGE

  1. 01 → Pick a version

    Version 4 is random and the right default. Version 7 puts a millisecond timestamp in the first 48 bits so the ids sort by creation time, which matters if they are a database primary key.

  2. 02 → Set how many you need

    Up to a thousand at a time. Each one draws its own bytes from the browser's cryptographic random source, so a batch is no more predictable than a single id.

  3. 03 → Choose the formatting

    Hyphenated lower case is the RFC form and what Postgres, MySQL and every JSON API expect. Braces and upper case are the Microsoft registry style; the hyphen-free form is for a 32-character field.

  4. 04 → Copy, download, or inspect

    Copy the list or save it as a file. Paste an existing GUID into the inspector to read its version, its variant, and for a v7 the moment it was created.

DESCRIPTION

A GUID, or UUID, is a 128-bit number written as 8-4-4-4-12 hexadecimal digits. The point is that any machine can mint one at any time without asking anything else for permission and still be confident nobody else has produced the same value. Version 4 achieves that by being almost entirely random: six of the 128 bits are fixed to record the version and the variant, leaving 122 random bits. That is a space of roughly 5.3 undecillion values, and you would need to generate about 2.7 quintillion of them before a collision became likely — which is why in practice nobody checks for one.

That guarantee is only as good as the random source, and this is where a lot of generators quietly fail. JavaScript's Math.random is a fast non-cryptographic PRNG with a small internal state, explicitly documented as unsuitable for anything security-sensitive; an attacker who sees a few outputs can predict the rest. Identifiers have a habit of ending up somewhere that matters — a password-reset URL, a session key, an invitation link, an object name someone can enumerate — so a guessable GUID becomes a real vulnerability. This tool reads its bytes from crypto.getRandomValues, the Web Crypto cryptographically secure generator, which is what makes a v4 from here genuinely unguessable.

Version 7 exists because random identifiers are hostile to databases. A B-tree index keyed on a v4 receives inserts in random order, so every insert touches a different page, the cache hit rate collapses and the index fragments. A v7 puts 48 bits of Unix milliseconds at the front, so a new id is always larger than an older one, inserts append to the right-hand edge of the index, and throughput looks like an auto-increment column while the remaining 74 random bits keep the value unguessable. The cost is that a v7 reveals roughly when it was created, which is usually fine and occasionally not.

Two other versions turn up often enough to recognise. Version 1 encodes a timestamp and the machine's MAC address, which makes it sortable but leaks the hardware identity — that is why v1 fell out of favour. Versions 3 and 5 are deterministic hashes of a name inside a namespace, so the same input always produces the same id; genuinely useful for deriving a stable id from something like a URL, but not a random identifier and never safe where unguessability matters. The nil UUID, all zeros, is a legal value meaning “no id at all”.

FAQ

## Are GUIDs and UUIDs the same thing?

Yes, in all but name. GUID is Microsoft's term and UUID is the RFC's; both describe the same 128-bit value in the same format. The only practical differences are historical — some older Microsoft tooling used a different byte order for the first three groups and wrote upper-case hex inside braces.

## Can two GUIDs ever be the same?

In theory yes, in practice no. With 122 random bits you would need about 2.7 quintillion version-4 UUIDs for a 50% chance of one collision. The real-world risk is not the mathematics but a bad random source: a generator seeded predictably, or one built on Math.random, can and does repeat.

## Should I use UUID v4 or v7 for a database primary key?

v7, if you have the choice. It sorts by creation time, so index inserts append rather than scatter, which avoids the write amplification and index bloat that random keys cause. Use v4 when the identifier is public and you would rather it did not reveal when the record was created.

## Is a GUID a secret?

Treat it as unguessable, not as a secret. A cryptographically generated v4 cannot be predicted, which is why unguessable-URL schemes work at all. But identifiers get logged, cached, sent in referrer headers and pasted into tickets, so anything that must stay confidential needs a real credential with an expiry instead.

## Does anything leave my browser?

No. The bytes come from crypto.getRandomValues in your own browser and the formatting happens on the page. That is the only way to be certain an identifier you are about to rely on has not been seen by anyone else.