![]() ![]() ![]() Now, it is quite possible that your strings are not exactly "sequences of uniformly random bytes" your strings have some meaning which means that most possible sequence of bytes will not occur, because they are meaningless. An encoding scheme must have an average length extension of a factor log 256 / log 62 = 1.344 (average over all sequences of bytes) otherwise, it means that some pigeons are being crushed to death somewhere and you will not get them back without damage (which means: two distinct strings encoded to the same, so decoding cannot work reliably). It is sometimes called the pigeonhole principle. On a general basis, if you want to encode arbitrary sequences of bytes into alphanumeric characters, there is necessarily some length extension somewhere, because there are 256 possible values for a byte, and only 62 alphanumeric characters. So Base64 also uses '/' and '+', which may or may not fit your bill. Uppercase letters, lowercase letters, and digits, that's 62. Note that Base64 is so called because it uses 64 distinct characters. You can remove it, since you can always put it back later on. The final '=' or '=' in Base64 is there only to make the number of characters a multiple of 4. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |