greenmachine Posted February 10, 2006 Posted February 10, 2006 I got the idea to make an all-around base converter to change numbers from one base to another. I'm about 99% done - or at least I thought I was until I went and looked up Base64 notation to make sure I was using the right characters. Up until I looked it up, I had assumed that it would follow the same pattern as the lower bases: 0-9 for the numbers 0-9, then A-F (in hex) for 10-15. I assumed this would keep going, so that base 36 would have 0-9 and then A-Z (10-36), and base 62 would have 0-9, A-Z, and a-z. Base64 introduces '+' and '/' for the values 62 and 63, but then also places A-Z first, followed by a-z and then 0-9 (+ and / are last either way). Why all of a sudden do the places switch? Is there a reason that A-Z is before the numbers, even though it makes more sense the other way? Or is Base64 really different, and I am just too unfamiliar with it to know? Base64 also has = as a "pad" character, which I don't understand either....
flyingboz Posted February 10, 2006 Posted February 10, 2006 I got the idea to make an all-around base converter to change numbers from one base to another. Base64 also has = as a "pad" character, which I don't understand either....Base64 is an encoding/decoding mechanism designed to move big ascii through smtp servers that weren't built for it - mail was an english text only affair back in the day The algorithms you will find googling for base64 implementations likely will have little to do with number base arithmetic. They simply provide a standardized way of taking things bigger than ascii 127 and representing them in a manner that an original SMTP server could process without munging. That's wherethe Line length and padding come into play.If you are purely interested in the math, implement in the same way you would binary, decimal or hex. Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now