私には大きな問題があり、あなたの助けが必要です。xtea アルゴリズムでデータを暗号化する必要があります。私はPythonの完全な初心者なので、それ以上のことはわかりません。
2 つのハッシュ化されたパスワードといくつかのデータをまとめました。私の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
この後、このエラーが表示されます:
トレースバック (最新の呼び出しは最後): Steganographie.py"、77 行目、data_en = xtea_algo(data_endi, normales_password) 内
Steganographie.py」、23行目、xtea_algo c = x.encrypt(text)
lib\site-packages\pep272_encryption__init__.py"、188 行目、encrypt encrypted_iv = self.encrypt_block(self.key, self._status) 内
lib\site-packages\xtea__init__.py"、230 行目、encrypt_block struct.unpack(self.endian + "2L", block) 内、
TypeError: 'str' ではなく、バイトのようなオブジェクトが必要です
与えられたパラメーターでタイプを制御しましたが、すべてのオブジェクトタイプは「バイト」です:(何かアイデアはありますか?