not so efficient implementation of base64