In the past couple months I’ve become increasingly more interested and fascinated in GitHub. Now, most of this is likely due to the newbie CS student thinking “Woahhh, revision control and free project hosting” but GH is pretty remarkable. A project I’ve always been interested in doing was a blog where I write about whatever, much like the page you are reading right now. Eventually I found Jekyll, but before that I toyed around with the idea of hosting the raw text files on GitHub, decoding the text from base-64, and then pasting that to the template/page that I was actually using for the blog (likely on GitHub). Now this idea is actually really dumb and a lot more difficult than it needs to be, but that didn’t stop me from making the base-64 decoder in C++, because why not.

So, by reversing Wikipedia’s algorithm for base-64 encoding, I spent a little time and built the decoder. Basically, the algorithm is just:

  1. Convert each encoded character to ASCII values
  2. String together 6-bit strings of ASCII values
  3. Break string up into 8-bit strings
  4. Convert 8-bit strings back into ASCII values
  5. Convert to decoded character

Nothing groundbreaking but it was a fun little project. And who wouldn’t prefer doing little projects instead of sleeping? You can find the code here.