I have to decode value '9DAFF2834DDD73C18D79E31DE22F0D49DF13E525D3FFAE599530BECCD1B916FF' to hex in python:
For this I am doing
>>> import binascii
>>>
>>> binascii.unhexlify('9DAFF2834DDD73C18D79E31DE22F0D49DF13E525D3FFAE599530BECCD1B916FF')
>>>'\x9d\xaf\xf2\x83M\xdds\xc1\x8dy\xe3\x1d\xe2/\rI\xdf\x13\xe5%\xd3\xff\xaeY\x950\xbe\xcc\xd1\xb9\x16\xff'
But, postgres is giving value as:
>>> db=> select decode('9DAFF2834DDD73C18D79E31DE22F0D49DF13E525D3FFAE599530BECCD1B916FF','hex') as sha;
The output is:
>>> \235\257\362\203M\335s\301\215y\343\035\342/\015I\337\023\345%\323\377\256Y\2250\276\314\321\271\026\377
Is there any equivalent in Python which will give same result as in Postgres (the Postgres output is a bytea)?