Re: ValueError: Error 3 while encrypting in ECB mode

2017-10-29 Thread Steve D'Aprano
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 "", line 1, in 
>   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.

-- 
https://mail.python.org/mailman/listinfo/python-list


ValueError: Error 3 while encrypting in ECB mode

2017-10-29 Thread Ho Yeung Lee
>>> 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 "", line 1, in 
  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
>>> ciphertext = encobj.encrypt("hellojalsdjflkdsjflds")
Traceback (most recent call last):
  File "", line 1, in 
  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
-- 
https://mail.python.org/mailman/listinfo/python-list