Posted by: Naveen Kapoor on: January 9, 2009
Base64 Encoding : Base64 encoding is a use to encodes arbitrary binary data as a string composed from a set of 64 characters. The character constitute of a 64 distinct ASCII characters,
”A” - “Z”
“a” - “z”
“0″ - “9″
“+” , “/”
For example, using this character set the 40-bit data:
01001000 01100101 01101100 01101100 01101111 cBase64 encoding for above binary data is : SGVsbG8=
Where “=” character is a padding character.
Why Base64 Encoding.
To transmit binary data on the communication channel that is designated to transmit the character data, like Emails. In case user want a binary image thru mail, User can apply base64 encoding on image Binary data and transmit the same thru mail. As Base64 encoding use only 64 character and these 64 characters can be represented with just 6 Bits
How it works:
lets take the above example :
Initals Binary Data:
01001000 01100101 01101100 01101100 01101111 ……………
To Result Bytes
XX010010 XX000110 XX010101 XX101100 …………………..
Final Result Chars
S G V t ……………………..
Encoding Process :
You can refer :