mervick / aes-everywhere

Aes Everywhere - Cross Language AES 256 Encryption Library (Bash, Powershell, C#, Dart, GoLang, Java, JavaScript, Lua, PHP, Python, Ruby, Swift)
Other
474 stars 169 forks source link

AttributeError: module 'time' has no attribute 'clock' #21

Closed iridesc closed 3 years ago

iridesc commented 4 years ago
a='hahaha'
e=aes256.encrypt(a,'12345678')
print(e)
d=aes256.decrypt(e,'12345678')
print(d)
Traceback (most recent call last):
  File "test.py", line 47, in <module>
    e=aes256.encrypt(a,'12345678')
  File "/usr/lib/python3.8/site-packages/AesEverywhere/aes256.py", line 57, in encrypt
    salt = Random.new().read(8)
  File "/usr/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 202, in read
    return self._singleton.read(bytes)
  File "/usr/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 178, in read
    return _UserFriendlyRNG.read(self, bytes)
  File "/usr/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 129, in read
    self._ec.collect()
  File "/usr/lib/python3.8/site-packages/Crypto/Random/_UserFriendlyRNG.py", line 77, in collect
    t = time.clock()
AttributeError: module 'time' has no attribute 'clock'
mervick commented 4 years ago

Seems it's a bug with pycrypto on python 3.8. https://github.com/dlitz/pycrypto/issues/283 It should be fixed by this PR https://github.com/dlitz/pycrypto/pull/296, but still not merged.

As a temporary solution, you can use pyhton 3.7 for avoid this bug.

iridesc commented 4 years ago

thanks for your work! now it's worked will in my project。

🐂🍻