I am trying to encrypt data and send it over a TCP socket to my server. However I am getting the error, ValueError: Key must be 128 bit long for the code below:
from xtea import *
from socket import *
import datetime
import time
import sys
clientsocket = socket(AF_INET,SOCK_STREAM)
clientsocket.connect(("xx.xx.xx.xx",1234))
key2="0wYwcOnn"
text = "$123456781|tx|id1^1.1^2015-09-29 16:38:44^2015-09-29 19:48:44"
x = new(key2, mode=MODE_ECB)
c = x.encrypt(text)
clientsocket.send(c)
recv = clientsocket.recv(1024)
print(recv)
Can anyone please comment on this?
Increase the key size to 16-bytes.
XTEA is a 64-bit block Feistel cipher with a 128-bit key. Since
"0wYwcOnn"is 64 bits (at best) what is the misunderstanding?