I am trying to base64 encode a binary string in NodeJS and python and I'm getting 2 different values.
Note that the value is i is 16 random bytes generated in python using os.urandom(16)
NodeJS
> var i = '>e\x93\x10\xabK\xbe\xfeX\x97\x9a$\r\xef\x8f3';
> var s = new Buffer(i).toString('base64');
> console.log(s);
PmXCkxDCq0vCvsO+WMKXwpokDcOvwo8z
Python
>>> import base64
>>> i = '>e\x93\x10\xabK\xbe\xfeX\x97\x9a$\r\xef\x8f3'
>>> s = base64.b64encode(i)
>>> print s
PmWTEKtLvv5Yl5okDe+PMw==
Am I doing something wrong? It does work for regular string such as my name.
NodeJS
> var s = new Buffer('travis').toString('base64');
undefined
> console.log(s);
dHJhdmlz
Python
>>> s = base64.b64encode('travis')
>>> print s
dHJhdmlz