Add base 32 encoding/decoding support.

Refactor base 64 encoding to support all encodings described in RFC 3548.