3 ms·
> based on a 190-bit, 32 character random nonce What am I missing? Shouldn't a "character" be 1 byte (or more)? -> 32*8=256 != 190 Even with another encoding,
by lukashed 13y ago
> based on a 190-bit, 32 character random nonce
What am I missing? Shouldn't a "character" be 1 byte (or more)? -> 32*8=256 != 190
Even with another encoding, with 190 bits for 32 characters, that would be 5.9375 bits/character which seems a bit strange to me.
- tlb 13y agoIt's base-62, just using the 52 alphabetics and 10 digits. Using just those characters ensures it can be typed and won't be mangled by international, HTML, or URL encodings. >>> log(62)/log(2) * 32 190.53428193238003
- srathi 13y agoPlease provide an example of base62 encoding. With base64, it is trivial to break 192 bits in a group of 6 bits each and assign one of the 64 characters to each (A-Z, a-z, 0-9, /, +). With 190 bits, how is the encoding done? I'm sorry if I'm missing something trivial here.
- signed0 13y agoBase62 is base64 without the '/' and '+'.
- Someone 13y agoHere's a hint: base10 encoding those 192 bits just means "write the number in decimal". Since 2^192 is about 6E57, that can be done in at most 58 digits. However, it is not possible to break 192 bits into 58 groups so that each group can be coded in one of those digits. Clearly, some of the bits must end up in more than one of those digits. base62 is similar to the base10 case, but uses 62 different digits. If this explanation is insufficient, check http://en.wikipedia.org/wiki/Ascii85 http://en.wikipedia.org/wiki/Ascii85. That's for base 85, but the approach is the same.
- srathi 13y agoThanks very much. I understand the generic method now. Base64 with 192 bits is just a special case where both 192 and 64 are powers of 2, which allows simple encoding by grouping the bits.
- ynniv 13y agoThe same way a base2 number can be represented in base10: http://www.epcc.edu/tutorialservices/valleverde/Documents/Number_Bases.pdf http://www.epcc.edu/tutorialservices/valleverde/Documents/Nu...
- tlb 13y agoIt's no harder than converting a binary number to decimal. But I doubt they store the 190 raw bits. Instead, the token is probably generated by appending 32 characters, each sampled randomly from the 62-character alphabet. The result has 190.53 bits of entropy.