We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi Fernando, I rewrited your code to the project python-ecdsa in branch ring-signature. zbohm/python-ecdsa@master...ring-signature
python-ecdsa
ring-signature
Please, would you be so kind to make me code review? Especialy file ring_signature_factory.py.
ring_signature_factory.py
Thanks a lot. Zdeněk
I recommend the code for easy viewing pycco:
pycco
$ git clone https://github.com/zbohm/python-ecdsa $ cd python-ecdsa/ $ git checkout ring-signature $ pip install --user pycco $ pycco src/ecdsa/ring_signature_factory.py $ firefox docs/ring_signature_factory.html
Example of usage:
$ virtualenv --python=python3 env $ source env/bin/activate $ pip install git+https://github.com/zbohm/python-ecdsa.git@ring-signature $ cat > example.py
import hashlib from ecdsa.curves import SECP256k1 from ecdsa.ecdsa import Private_key, Public_key from ecdsa.ring_signature import signature_from_pem from ecdsa.ring_signature_factory import ( RingSignatureFactory, get_ring_signature_factory ) from ecdsa.util import randrange curve = SECP256k1 g = curve.generator n = g.order() number_participants = 10 my_private_key_position = 2 # Generate private and public keys: private_keys, public_keys = [], [] for i in range(number_participants): secret = randrange(n) pubkey = Public_key(g, g * secret) privkey = Private_key(pubkey, secret) public_keys.append(pubkey) private_keys.append(privkey) message = b"Life, the Universe and Everything." # Make signature: factory = RingSignatureFactory(curve, hashlib.sha3_256) signature = factory.sign( message, private_keys[my_private_key_position], public_keys, my_private_key_position, ) # Export to PEM: pem = signature.to_pem() print(pem.decode()) # Import from PEM: sig = signature_from_pem(pem) # Verify signature: factory2 = get_ring_signature_factory(sig) if factory2.verify(message, sig, public_keys): print("OK. Signature is valid.") else: print("Error. Invalid signature.")
$ python example.py $ deactivate
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi Fernando,
I rewrited your code to the project
python-ecdsa
in branchring-signature
.zbohm/python-ecdsa@master...ring-signature
Please, would you be so kind to make me code review? Especialy file
ring_signature_factory.py
.Thanks a lot.
Zdeněk
I recommend the code for easy viewing
pycco
:Example of usage:
The text was updated successfully, but these errors were encountered: