我试图在这里使用这个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
我该怎么解决?