Re:Type-safe, K-sortable, globally unique identifier inspire...
by Ironchefpython on Wednesday June 28, 2023 @10:51PM
(#36515756)
https://datatracker.ietf.org/doc/html/rfc2550
Note that this RFC also supports lexicographic sorting for negative numbers using the 10k complement notation.
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
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,
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