![]() ![]() Take ASCII values of input characters separately:.There are five steps we take during this process: Manual Encodingįor example, let's say we have a string - ABC123 that we'd like to encode in Base64. Let's go ahead and manually encode a simple string to get a good idea of how the process works. Though, this is impractical due to difficulties in the encoding/decoding process. You could go higher than this and have each character represent 8 bits. So 64 characters of Base64 can be written as:Įach character is represented in 6 bits. Note: There is also a 65th character ( =), which serves a special meaning and it's called a padding character.Īs usual, when it comes to computers, numbers are represented in powers of 2. In Base64, as the name suggests, there are 64 characters used to encode binary data. While it does "obscure" the data to a degree, it's not a secure format by any means since reversing the encoding is trivial. What Base64 isn't is an encryption algorithm. It's very useful for storing image/audio information as strings of information. It's represented as printable ASCII characters where each Base64 character contains 6 bits of binary information. What is Base64?īase64 is a binary-to-text encoding scheme. Decoding is the reverse process of encoding - turning the encoded data back to the original format.Įncoding is all around us and computers heavily rely on different encoding formats to deliver and transfer information.įrom the latest cat image in your feed to the voice message you listened to over a messaging app - all of these were encoded on the sender-side, delivered to you, and decoded on the recipient-side.Įncoding makes sure that data remains intact and efficient for transport. The encrypted data is a good candidate to Base64-encode though, if you need to store the encrypted data in a text file.The process of converting data by applying some techniques/rules into a new format is called encoding. ![]() If you need to hide your data, use encryption. Numerous tools are available to decode the data without the need for any key. If you would like to obfuscate the data, then Base64 will offer you a very poor security mechanism. Also, mail and file systems can now cope with 4 byte words containing millions of characters. Base64 encoded data might save you some trouble there. Some of those settings may contain characters that aren't allowed in the file, like encrypted passwords, html snippets or other arbitrary data. ![]() Say for example that you have an xml, unix config or java property file with settings for an application. Well, it's often used when you already have binary data and you still want to store the data in a 7 bit environment. If the last group contains two characters the encoding will have just one = character. If the last 24 bits contain only one character, that character is encoded into two characters and the last two spots will be padded with the characters =. The = character is a padding character added at the end of the encoding in case the input data is not dividable by 3. 6 bits can contain 2^6 combinations, which is 64, thus the name Base64. Each section of 6 bits is then translated into a new character in the range a-zA-Z0-9+/. Now, the resulting 24 bits are split into four sections of 6 bits instead. ![]() Since 8 bit characters consist of, well, 8 bits, Base64 encoding groups the characters into groups of three 8 bit characters, yielding 24 bits. The original RFC for Base64 was the Privacy-enhanced Electronic Mail (PEM) RFC 989 but now numerous variations exists, as well as RFC:s, like the RFC 1421, RFC 2045, RFC 3548, RFC 4848 and several other as well. This was mostly used in transfering of data across 6 or 7 bit connections. In short, Base64-encoding is a way to encode 8 bit character data in a series of 6 bit characters. ![]()
0 Comments
Leave a Reply. |