adamvr / arduino-base64

A base64 library for the arduino platform, written in C
MIT License
183 stars 102 forks source link

Base64 encoding differs from the Erlang one #1

Closed sivieri closed 13 years ago

sivieri commented 13 years ago

Hi,

I am working on an implementation of OAuth for making authorized requests to Twitter, and I am using your library. I have just found out that sometimes (looks like two out of three times) I obtain different values than the base64 Erlang implementation, and in these cases Twitter refuses to answer because of bad authentication.

For example, the sha-hmac implementation returns me a list of the following bytes (each value from 0 to 255, of course):

90 114 197 46 26 146 78 211 61 102 19 97 252 102 251 251 132 8 164 238

which I cast to characters and pass them to the base64_encode function, obtaining the following:

WnLFLhqSTtM9ZhNh+Gb704QIpO4=

which is refused by Twitter, while the Erlang answer (accepted by the server) with the same list is:

WnLFLhqSTtM9ZhNh/Gb7+4QIpO4=

Do you happen to have an idea of the reason behind this?