I have a hexadecimal value that I extract from a text file, then I pass it to a2b_hex to convert it to the corresponding binary representation. Here is what I have:
k = open('./' + basefile + '.key', 'r')
k1 = k.read()
k.close()
my_key = binascii.a2b_hex(k1)
When I type k1, this is as expected: 81e3d6df
Here is the error message:
Traceback (most recent call last):
File "xor.py", line 26, in <module>
my_key = binascii.a2b_hex(k1)
TypeError: Odd-length string
Any suggestions? Thank!
source
share