skorokithakis / shortuuid

A generator library for concise, unambiguous and URL-safe UUIDs.
http://www.stavros.io/
BSD 3-Clause "New" or "Revised" License
2.05k stars 109 forks source link

Question: Shortest possible shortuuid encoding? #106

Open mecampbellsoup opened 1 month ago

mecampbellsoup commented 1 month ago

Without dipping below the amount of entropy in a uuid.UUID4, what is the fewest number of base57-encoded characters we could encode to? Is this documented anywhere? If not, do you think it would be a useful thing to mention?

skorokithakis commented 1 month ago

Some simple math should get you the number of base57 digits you need to represent 128 bits: 128/log2(57) = 22 digits (which is the length of a shortuuid by default, but maybe that's not documented explicitly).