5 ms·
The first link is a hex encoded token, 80 chars, 4 bits per char = 320 bits of information. The second shortened link key is likely base 64 encoded, 5 chars, 64
by natdempk 5y ago
The first link is a hex encoded token, 80 chars, 4 bits per char = 320 bits of information. The second shortened link key is likely base 64 encoded, 5 chars, 64 bits per char = 320 bits of information. These should be basically the same from a security perspective. Is there something I'm missing here that you're suggesting?
Edit: This is wrong and should be 30 bits of information not 320 bits for the shortened form. 64 values = 6 bits not 64 bits.
- niklasbuschmann 5y agobase64 -> 64 possibilities -> 6 bits I guess?
- wizzwizz4 5y ago> The second shortened link key is likely base 64 encoded, 5 chars, 64 bits per char No, 64 values – or 6 bits. 6×5=30, not 320.
- natdempk 5y agoAh, RIP, my math is incorrect. Thanks.
- deleted 5y ago[deleted]
- joombaga 5y agoI think it's usually base62.
- ______- 5y agohttps://www.kerstner.at/2012/07/shortening-strings-using-base-62-encoding/ https://www.kerstner.at/2012/07/shortening-strings-using-bas...
- rascul 5y agoProbably is. Base64 includes + and / which I believe need to be URL encoded, plus the = padding can mean an extra step if you want to remove them to make the URL pretty. https://en.wikipedia.org/wiki/Base64#Base64_table https://en.wikipedia.org/wiki/Base64#Base64_table
- natdempk 5y agoYou can also use an alternate alphabet like this one https://base64.guru/standards/base64url https://base64.guru/standards/base64url which replaces +/ with -_ which are URL safe characters.
- treve 5y agoWe also don't know if the shortened urls are random.