3 ms·
for those researching this topic, I keep a list of these UUID/GUID implementations! https://github.com/swyxio/brain/blob/master/R%20-%20Dev%20Notes/uuid%20list
by swyx 3y ago
for those researching this topic, I keep a list of these UUID/GUID implementations!
https://github.com/swyxio/brain/blob/master/R%20-%20Dev%20Notes/uuid%20list.md https://github.com/swyxio/brain/blob/master/R%20-%20Dev%20No...
- crdrost 3y agoThanks for this! I have one idea which is perhaps nerdy enough to make the list but I've never fully fleshed it out, it's that one can encode the nonnegative integers {0, 1, 2, ...} into the finite bitstrings {0, 1}* in a way which preserves ordering. So if we use hexits for the encoding the idea would be that 0=0, 1=1, ... E=14, then F00 = 15 F01 = 16 ... F0F = 30 F100 = 31 F101 = 32 ... F1FF = 286 F2000 = so the format is F, which is the overflow sigil, followed by a recursive representation of the length of the coming string, followed by a string of hexits that long. What if you need 16 hexits? That's where the recursion comes in, F F00 0123456789ABCDEF \ \ \ \ \ \----- 16 hexits \ \ \ \-- the number 15, "there are 15+1 digits to follow" \ (consisting of overflow, 0+1 digits to follow, and hex 0) \ \--- overflow sigil Kind of goofy but would allow a bunch of things like "timestamp * 1024 + 10-bit machine ID" etc without worrying about the size of the numbers involved
- Ironchefpython 3y agohttps://datatracker.ietf.org/doc/html/rfc2550 https://datatracker.ietf.org/doc/html/rfc2550 Note that this RFC also supports lexicographic sorting for negative numbers using the 10k complement notation.
- CMCDragonkai 3y agoWe have a uuidv7 implementation that we've been using with rocksdb for over a year https://github.com/matrixai/js-id https://github.com/matrixai/js-id