Don’t Base64 encode things that users should enter

Base64 encoding is great for converting binary data into a string representation which can be transported over text based protocols like soap or json. Unfortunately Base64 uses a character set which is difficult for humans to interpret so for any data that needs to be human interpretable, like binary representations added to urls, base64 can be a real problem. Douglas Crockford solved this issue years ago with his special Base32 encoding scheme which uses a character set of letters and numbers where letters which may be mixed up like I, l and O are excluded. In addition the decoding rules state that these invalid characters should be replaced with the character that they look like. The decoding is not case sensitive and may optionally include dashes which should be stripped before decoded into its binary/decimal representation to allow you to group characters for easier entry – I wonder if the Windows activation keys are base32? Anyway the scheme is simple yet effective!

Beware that there are other base32 encoding schemes that do not create user friendly values and are not compatible with Crockfords scheme…

I was going to write a custom encoder/decoder for a project I am working on since the .Net framework does not have a base32encoder implementation but fortunately someone beat me to it! It’s available on codeplex: http://crockfordbase32.codeplex.com

Leave A Comment...

*