shortest encoding for Guid for use in a URL

前端 未结 2 1592
轮回少年
轮回少年 2021-01-11 09:43

Mad Kristensen got one down to 00amyWGct0y_ze4lIsj2Mw

Can it go smaller than that?

2条回答
  •  悲哀的现实
    2021-01-11 10:36

    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.

提交回复
热议问题