RFC 4648 specifies a way to transmit any binary data as a sequence of characters with a limited alphabet, for systems that cannot accomodate the full 256 character set available to an eight-bit byte. It provides for three kinds of alphabets... one limited to 16 characters, another limited to 32 characters, and yet another limited to 64 characters (base16, base32, and base64 respectively). Several underlying specifications require the uses of one or more of these encoding schemes (e.g. MIME), making them required for several purposes.

I did not happen to find an implementation in C++ for these that quite met my goals of being fast, flexible, yet easily maintained, so I thought I would take a crack at writing one based on the code written by Chris Venter, as last updated in 2010-06-15.

If you would like, download the files (which includes a VC++ 2010 project file) and take a look at the test code for yourself. You should be able to compile this on any C++ compiler for any OS, provided the compiler has the std::unordered_map object in its standard template library. I do not have a makefile for POSIX systems, but I'll be happy to accept one.

If you would care to submit an improvement or fix to this, feel free to e-mail me (top page of this site).

Feel free to use this without restriction. This is donated to the public domain.

Download: (17,121 bytes)