From 579e4aa1bc8623b7427f47442f2de18464fb32a0 Mon Sep 17 00:00:00 2001 From: Vasily Kolesnikov Date: Tue, 4 Jul 2023 23:23:16 +0300 Subject: [PATCH] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 18b2f65..230e268 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ # UUIDv6 +**TL;DR:** UUIDv6 based on UUIDv1. `SecureRandom.uuid` != UUIDv1 != UUIDv6. `SecureRandom.uuid` is UUIDv4. + +--- + **UUID v6** pure Ruby implementation. See http://gh.peabody.io/uuidv6/ for details. The expected[^1] use case for UUIDv6 is as a drop-in replacement for UUIDv1 which offers improved DB locality. If you don’t have the requirement to keep compatibility with UUIDv1 the suggestion is to use UUIDv7 instead. The only real difference between UUIDv6 and UUIDv1 is the order of the timestamp bits. Starting with the 60-bit timestamp, the first 48 bits of the timestamp come first in the UUID (the specification splits this between time_high, and time_mid likely to keep the same terms as RFC 4122). The next 4 bits contain the version (0110 in this case for v6) and then the final 12 bits of the timestamp can be found. This leads to the following difference: