#javascript #python #cryptojs #pycrypto #pycryptodome
Вопрос:
у меня есть мой ключ aes meta_key=cb0e3156-e1d2-460c-87f0-cb382dd0f09b154dda513-5404-473c-b581-d02bfb760162SD
ключ после кодирования в sha256 final_key=fcacdebc2a5ee99ef9e74eab6e90f0cdcae84112055cc9d2a8cbfecfd2bd2c9d
#это последний ключ
iv=[203 75 240 106 52 8 105 107 229 6 255 31 74 177 210 222]
#uint8array
ciphertext=[197 148 96 ... 244 127 133]
#uint8array
однако, когда я освобождаю
aes = AES.new(dec_key, AES.MODE_CBC, iv)
encrypted = aes.decrypt(ciphertext)
print(encrypted
я получаю сообщение об ошибке ValueError: Incorrect AES key length (64 bytes)
я пытаюсь воспроизвести
key = CryptoJS.SHA256(key);
const decryptedWordArrayChunk = CryptoJS.AES.decrypt(
{
ciphertext: CryptoJS.lib.WordArray.create(chunk),
salt: ''
},
key,
{
iv: initializationVector,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.NoPadding
}
);
Как мне сделать то же самое в python?