I have a hex value that I\'m grabbing from a text file, then I\'m passing it to a2b_hex to convert it to the proper binary representation. Here is what I have:
read() doesn't strip newlines. If there's a '\n' at the end of your file, it'll be in k1.
read()
'\n'
k1
Try binascii.a2b_hex(k1.strip()) or possibly binascii.a2b_hex(k1[:8]).
binascii.a2b_hex(k1.strip())
binascii.a2b_hex(k1[:8])