我有个大问题,需要你的帮助。 我必须用xtea算法加密我的数据。我是python的初学者,所以我不知道更多
我把两个散列密码和一些数据放在一起。因为我的xtea算法不想包含任何字符串,所以我对其进行了编码(编码“utf-8”在此处不起作用)
datas = macpassword_hashed_versch + tea_password + txt_neu
data_endi = str.encode(datas)
normales_password = normales_password.encode('utf-8')
data_en = xtea_algo(data_endi, normales_password)
这是我的xtea:
def xtea_algo(message, p):
key = p
text = message * 8
x = new(key, mode=MODE_CFB, IV="12345678")
c = x.encrypt(text)
return c
在此之后,它会给我以下错误:
Traceback (most recent call last): Steganographie.py", line 77, in data_en = xtea_algo(data_endi, normales_password)
Steganographie.py", line 23, in xtea_algo c = x.encrypt(text)
lib\site-packages\pep272_encryption__init__.py", line 188, in encrypt encrypted_iv = self.encrypt_block(self.key, self._status)
lib\site-packages\xtea__init__.py", line 230, in encrypt_block struct.unpack(self.endian + "2L", block),
TypeError: a bytes-like object is required, not 'str'
我控制了给定参数中的类型,每个对象类型都是“字节” :(你们有什么想法吗
目前没有回答
相关问题 更多 >
编程相关推荐