Traceback (most recent call last):
File “C:\Users\billl\AppData\Local\Continuum\anaconda3\lib\site-packages\IPython\core\interactiveshell.py”, line 2963, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “”, line 1, in
AES.new(“asssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssdfasasasasa”, AES.MODE_ECB)
File “C:\Users\billl\AppData\Local\Continuum\anaconda3\lib\site-packages\Crypto\Cipher\AES.py”, line 232, in new
return create_cipher(sys.modules[name], key, mode, *args, **kwargs)
File "C:\Users\billl\AppData\Local\Continuum\anaconda3\lib\site-packages\Crypto\Cipher_init.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File “C:\Users\billl\AppData\Local\Continuum\anaconda3\lib\site-packages\Crypto\Cipher_mode_ecb.py”, line 215, in _create_ecb_cipher
cipher_state = factory._create_base_cipher(kwargs)
File “C:\Users\billl\AppData\Local\Continuum\anaconda3\lib\site-packages\Crypto\Cipher\AES.py”, line 93, in _create_base_cipher
raise ValueError(“Incorrect AES key length (%d bytes)” % len(key))
ValueError: Incorrect AES key length (95 bytes)
这个报错是说AES的KEY长度超过了限制
除了MODE_SIV模式key长度为:32, 48, or 64,
其余key长度为16, 24 or 32
内部函数说明:
“”"Create a new AES cipher.
:param key:
The secret key to use in the symmetric cipher.
It must be 16, 24 or 32 bytes long (respectively for *AES-128*,
*AES-192* or *AES-256*).
For ``MODE_SIV`` only, it doubles to 32, 48, or 64 bytes.
:type key: bytes/bytearray/memoryview
:param mode:
The chaining mode to use for encryption or decryption.
If in doubt, use ``MODE_EAX``.
:type mode: One of the supported ``MODE_*`` constants
ID:Python之战
|作|者|公(zhong)号:python之战
专注Python,专注于网络爬虫、RPA的学习-践行-总结
喜欢研究和分享技术瓶颈,欢迎关注
独学而无友,则孤陋而寡闻!