Here's how it works.
Encoding only - you'll have to figure out the decoding.
Base64 works on groups of 3 characters:Lets take 3 characters: mic
Convert to ACSII: i.e. 109, 105, 99
Convert to Binary 01101101/ 01101001/ 01.....
Split binary string into groups of 6 bits: 011011 010110 100101 etc
Convert to Decimal: 27, 22, 37
Find the Base64 encoding table on web. http://www.faqs.org/rfcs/rfc1521.html
Substitute the numbers for the letters of the Base64 encoding table:i.e. 27 => b, 22 => W, 37 => l
Simple:Rules for understanding Base 64
1. Find a base 64 encoder on the web
2. Learn to differentiate between file headers and data.
3. Encode a known (short) string
4. Encode the string using the approach outlined above.
5. Verify that both results match
6. Now decode the encoded string (hint: reverse encode)
7. Write a 'decode' C program
8. Refine your program so that code is terse. Proxomitron can be used to 'see' some base64 encoded data. Check it out.
This article was originally published by CyberArmy.net in the CyberArmy Library.
|
|