我正在尝试加密数据并通过 TCP 套接字将其发送到我的服务器。但是我收到错误,ValueError: Key must be 128 bit long for the code 以下代码:
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)
任何人都可以对此发表评论吗?