Ask HN: Why not use a higher base than Hex for UUIDs if they're just strings?
https://news.ycombinator.com/item?id=14428644If we're storing and sending them as strings, why not take up less space by bumping up the radix to harness more available characters? Going from hex to Base64 alone would be a seemingly obvious place to start, since Base64 is already a well established radix specifically for leveraging the fact that strings have quite a few characters available to them.
With Hexadecimal, we get 4 bits per character. With Base64, we get 6 bits per character. To keep UUIDs at 128 bits, we'd go from 32 to 22 characters in length.
So why do we use hexadecimal representation when it is literally just a string, and could be anything? Even keeping the radix in powers of 2 is kind of unnecessary if these are being stored and transmitted as strings, the radix at that point just becomes a mechanism for allowing additional combinations. We could use any arbitrary number of characters per digit and it would serve that purpose. There are 91 ASCII characters available, so what gives?
Additionally, why the dashes? If we reserve digits for meaning per standard, such as UUIDv1 MAC address + time, why not just go off of digit position? In a string, that dash takes up just as much wasted space as the additional characters which are providing data utility.