좀 파이썬 코드가,파이썬 hashlib.sha256() 소화 길이
hash_object = hashlib.sha256(b'Hello World')
hex_dig = hash_object.hexdigest()
cipher = AES.new(hex_dig, AES.MODE_CBC, iv)
plain = cipher.decrypt(cipher)
하지만, 나는 오류가 - ValueError를 : AES 키는 16, 24, 또는 32 바이트이어야합니다
하지만, 나는 16bytes 키가 아닌 32bytes 키를 원한다. hash_val = hashfct.digest()가 32bytes가 아닌 이유를 모르겠습니다. 또한 "hash_val = hashfct.digest() [0:32]"를 시도했지만 작동하지 않습니다.
어떻게 32byte의 긴 키를 얻을 수 있습니까?
감사합니다.