Reputation: 5040
I've been seeing some discrepancies in the base64 encoding in many utils from the unix util
for ex:
in java and python if I encode b
I get Yg==
but in unix I get Ygo=
I need to use b64 from unix in java and python. How do I make them consistent?
Upvotes: 3
Views: 463
Reputation: 798774
Suppress the newline.
echo -n "b" | ...
Or add it.
>>> 'b\n'.encode('base64')
'Ygo=\n'
Upvotes: 4