Py学习  »  Python

我从github运行python代码进行加密。很多错误使我无法正确执行它

just_learning • 4 年前 • 329 次点击  

我试图在这里使用这个python代码,但没有成功:

https://github.com/debajyotiguha11/PyCrypto

我运行脚本,但出现以下错误:

Do you want to (E)ncrypt or (D)ecrypt? *Case Sensitive*
E
Enter the password:
abcd
Traceback (most recent call last):
  File "pycrypto3.py", line 84, in <module>
    encrypt(SHA256.new(password).digest(), str(Tfiles))
  File "/usr/local/lib/python3.7/dist-packages/Crypto/Hash/SHA256.py", line 88, in new
    return SHA256Hash().new(data)
  File "/usr/local/lib/python3.7/dist-packages/Crypto/Hash/SHA256.py", line 75, in new
    return SHA256Hash(data)
  File "/usr/local/lib/python3.7/dist-packages/Crypto/Hash/SHA256.py", line 72, in __init__
    HashAlgo.__init__(self, hashFactory, data)
  File "/usr/local/lib/python3.7/dist-packages/Crypto/Hash/hashalgo.py", line 51, in __init__
    self.update(data)
  File "/usr/local/lib/python3.7/dist-packages/Crypto/Hash/hashalgo.py", line 69, in update
    return self._hash.update(data)
TypeError: Unicode-objects must be encoded before hashing

我该怎么解决?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/50950
 
329 次点击