import binascii crypto = '000000000000000000000000000000000000000000000000000000000001011100000110000100000001010000000001' key = '010101110100010101001100010000110100111101001101010001010101010001001111010000110100011001000110' c = '' str = '' for i in range(len(crypto)): if (key[i] == crypto[i]): c+='0' else: c+='1' print(c); for i in range(0,12): str += chr(int(c[i*8:i*8+8],2)) print str