I am trying to convert python3 code into python2 but output seems to be different.
The code in python2 is:
import base64
crypto = 'aGVsbG8=' #=hello
s = base64.b64decode(crypto)
print(s)
It prints what I want: Something like- Cs~as59 whatever
But for python3 the same script prints something like: b'\x45\x67\xe3'
Why am I getting different output for same input?
b64decodeis a sequence of bytes. In Python 2.x, that's exactly what a string was, so that's what was returned. But in Python 3, strings are now Unicode, so things that are explicitly composed of bytes use a separate bytestring type, indicated by thebprefix. Both of your outputs will be exactly the same data, just shown in two different representations.