问题
Mad Kristensen got one down to 00amyWGct0y_ze4lIsj2Mw
Can it go smaller than that?
回答1:
Looks like there are only 73 characters that can be used unescaped in a URL. IF that's the case, you could convert the 128-bit number to base 73, and have a 21 character URL.
IF you can find 85 legal characters, you can get down to a 20 character URL.
回答2:
A GUID looks like this c9a646d3-9c61-4cb7-bfcd-ee2522c8f633 - that's 32 hex digits, each encoding 4 bits, so 128 bits in total
A base64 encoding uses 6 bits per symbol, which is easy to achieve with URL safe chars to give a 22 char encoded string. As others have noted, you could with with 73 url safe symbols and encoded as a base 73 number to give 21 chars.
来源:https://stackoverflow.com/questions/1278934/shortest-encoding-for-guid-for-use-in-a-url