Byte Conversion
Algorithms
Site Map Feedback
Up ASCIIHex Base32 Base64 MIME QuotedPrintable URL UU

Turn Binary Data to Text and back

The code I'm presenting here demonstrates the following conversions:
  • ASCIIHex: Convert a CString of binary data to Hex and back.
  • Base32: The simplest code for binary - text conversion. Four binary Bytes are turned into seven text Bytes.
  • Base64: Four binary Bytes are turned into seven text Bytes.
  • MIME: Multipurpose Internet Mail Extensions: Pulling the encoding methods together.
  • QuotedPrintable: Used for emails. Intended for data which is nearly all already text.
  • URL: URL encoding is used by web browsers which UTF-8 encode certain characters.
  • UU: Unix-to-Unix encoding keeps data out of the two most significant bits of each Byte. Three binary Bytes are turned into four encoded Bytes.
e-mails are sent purely as text: to get an attached binary file across the Internet, the binary data gets converted into text and sent as part of the text message. The e-mail client converts the text-encoded attachment and turns it back into a binary file.

Similarly, when you install software and are asked to enter a 'serial code'; the letters and numbers you are typing usually represent a number that the computer is using as an encryption key.
The code in this section converts between text and binary data.
 (63) Last modified: Wed, 02 Sep 2009 17:02:15 +0100

You can email, bookmark, or share this page by clicking the social networking icons below:

  • E-mail this page to a friend!
  • Google
  • Live
  • YahooMyWeb
  • TwitThis
  • StumbleUpon
  • Digg
  • Reddit
  • Facebook
  • del.icio.us
  • LinkedIn
  • Mixx
  • connotea
  • Sphinn
  • Slashdot
  • Technorati