小编Rah*_*kur的帖子

ModuleNotFoundError:没有名为“Crypto”的模块

我安装了 Crypto 模块和 SHA256 但显示 ModuleNotFoundError :-

回溯(最近一次调用最后一次):文件“Digitalsig.py”,第 1 行,来自 Crypto.Hash import SHA256 ModuleNotFoundError:没有名为“Crypto”的模块

这是参考代码

from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
from Crypto import Random

random_generator = Random.new().read

#used to generate a keypair which contain a public and private key
keyPair = RSA.generate(1024,random_generator)
pubKey = keyPair.publicKey()

plainText = 'Hello World'
hashA = SHA256.new(plainText).digest()
digitalSignature = keyPair.sign(hashA,'')

print("Hash A: "+repr(hashA) + "\n");
print("Digital Signature: " + repr(digitalSignature) + "\n")

#Bob receives the plainText and digitalSignature from Alice 
#plainTextChanged ='Hello …
Run Code Online (Sandbox Code Playgroud)

python cryptography sha256 pycrypto rsa-sha256

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

cryptography ×1

pycrypto ×1

python ×1

rsa-sha256 ×1

sha256 ×1