| header pic goes here | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| log in for personalized pages! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tutor Section: How to translate into base64 and backReturn to base64 Javascript tutorialReturn to tutor home Base64 is a different way of interpreting bits of data in order to transmit that data over a text-only medium, such as the body of an e-mail. In the standard ASCII character set, there are 256 characters that are used to format text. However, only a fraction of these characters are actually printable and readable when you are looking at them onscreen, or sending them in an e-mail. So how do you convert nonprintable characters into printable characters? There are several ways, but my preferred way is using base64 encoding. The 256 characters in the ASCII character set are numbered 0 through 255. For the tech savvy, this is the same as 28, 8 binary placeholders, or a byte. So for any ASCII character, you simply need one byte to represent this data. Because we are now detached from ASCII characters, you can also apply these same techniques to binary data, for example, a picture, or executable file. All you are doing is interpreting data one byte at a time. The problem with representing data one byte at a time in a readable manner is that there are not 256 readable characters in the ASCII character set, so we cannot print a character for each of the 256 combinations that a byte can offer. So we need to take a different approach to looking at the bits in a byte. So what if instead of looking at a whole byte, we looked at half of a byte, or 4 bits (also known as a nibble) at a time. This would be entirely possible because 24 is equal to 16, and there are certainly sixteen readable characters that we could use to represent each variation of nibble. This type of translation is know as hex. See the table below for the hex character set.
Continue to using base64 instead of hex. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() This work is licensed under a Creative Commons License. aardwulf systems |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||