Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'sign', 'verify' #58

Open
MilanObrenovic opened this issue Oct 6, 2022 · 1 comment
Open

ImportError: cannot import name 'sign', 'verify' #58

MilanObrenovic opened this issue Oct 6, 2022 · 1 comment

Comments

@MilanObrenovic
Copy link

from pycoin.ecdsa import generator_secp256k1, sign, verify
import hashlib, secrets

def sha3_256Hash(msg):
hashBytes = hashlib.sha3_256(msg.encode("utf8")).digest()
return int.from_bytes(hashBytes, byteorder="big")

def signECDSAsecp256k1(msg, privKey):
msgHash = sha3_256Hash(msg)
signature = sign(generator_secp256k1, privKey, msgHash)
return signature

def verifyECDSAsecp256k1(msg, signature, pubKey):
msgHash = sha3_256Hash(msg)
valid = verify(generator_secp256k1, pubKey, msgHash, signature)
return valid

i think the example code is broken or outdated. i cant import sign or verify at all

@etherx-dev
Copy link

download https://github.com/richardkiss/pycoin/releases/tag/0.70 and do

pip3 install pycoin-0.70.tar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants