ValueError: Error 3 while encrypting in ECB mode

Steve D'Aprano steve+python at pearwood.info
Mon Oct 30 00:40:08 EDT 2017


On Mon, 30 Oct 2017 01:20 pm, Ho Yeung Lee wrote:

>>>> from Crypto.Cipher import AES
>>>>
>>>> key = 'mysecretpassword'
>>>> plaintext = 'Secret Message A'
>>>> encobj = AES.new(key, AES.MODE_ECB)
>>>> ciphertext = encobj.encrypt("hello")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "C:\Python27\lib\site-packages\Crypto\Cipher\_mode_ecb.py", line 124,
>   in encrypt
>     raise ValueError("Error %d while encrypting in ECB mode" % result)
> ValueError: Error 3 while encrypting in ECB mode

What does the documentation for the Crypto.Cipher.AES object say?

Did you try googling for the error message?

https://duckduckgo.com/?q=Error+3+while+encrypting+in+ECB+mode

https://www.google.com.au/search?q=Error+3+while+encrypting+in+ECB+mode


which gives me this:

https://stackoverflow.com/questions/14179784/python-encrypting-with-pycrypto-aes

among other possible answers.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list