Base64

If binary date has to be transmitted, it will usually be packed into frames having additional bytes formatting those frames by telling where the frame starts and where it ends. This has to be interpreted by the communication software. When tripped out of synchronization, the data bytes however could be misinterpreted as if they would be the additional frame formatting bytes. Usually data was meant to be just pure ASCII containing 7 bits. So when the 8th bit was set, then it was assumed to be some framing information. When the 8th bit was used for data, a potential danger was created. Base64 takes 3 binary bytes and copies it into 4 bytes assuring that no bit gets lost and the 8th bit will be 0. This way binary data can be transmitted without danger.

As example base64 is used in email to embed pictures. Such pictures can be extracted when the email source is observed. e-mails are pure ASCII and structured in different section. The section

Content-Type: image/jpeg; name="Picture (Device Independent Bitmap) 1.jpg"
""" 
Content-Transfer-Encoding: base64 

identifies that a jpeg picture is embedded. From the e-mail programs source view, cut and past this base64 coded jpeg into a text file. After that run base64 -d <textfile> > <name of the picture>.jpg. Maybe some errors and warning pop up that might be stuff that got inserted by the e-mail program and the text editor due to formatting reasons (as cr/lf). Since base64 is quite robust and contains just ASCII it still produces the desired jpg that now can be observed using a jpeg viewer.


Linurs startpage