Port of Nick Galbreath's JS base64 string encoder.