With that deeper understanding of how it works, let's look at why would we Base64 encode our data. To Base64 encode a string, we convert it to binary sequences, then to decimal sequences, and finally, use a lookup table to get a string of ASCII characters. You can verify this result with an online converter. Continuing this lookup for all decimal values, we can determine that "Python" is represented as UHl0aG9u when Base64 encoded. Then we look at 7 and observe it's mapped to H. Using our last result, we get the following decimal values: 20 7 37 52 26 6 61 46Īs you can see, the value 20 corresponds to the letter U. With our data in groups of 6 bits, we can obtain the decimal value for each group. If that occurs, we have to pad the sequence. Note: Sometimes we are not able to group the data into sequences of 6 bits. We now re-group the 8-bit binary sequences into chunks of 6 bits. Recall that Base64 characters only represent 6 bits of data. The ASCII values of the characters P, y, t, h, o, n are 15, 50, 45, 33, 40, 39 respectively. Let's see how it works by converting the string "Python" to a Base64 string.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |