Added pseudo-randgen and keypair generator

parent e7740e78
......@@ -7,6 +7,8 @@ import logging
logger = logging.getLogger(__name__)
class Network():
def __init__(self):
self.nodes = {}#{1 : Node(1),2:Node(2)}
......
from ecdsa import SigningKey
# import secrets
import random
def pseudoRandomGenerator(seed) :
random.seed(seed)
return random.getrandbits(256)
def genratePublicPrivateKey():
sk = SigningKey.generate() # uses NIST192p
vk = sk.get_verifying_key()
signature = sk.sign(b"message")
assert vk.verify(signature, b"message")
return (sk,vk)
pass
if __name__ == '__main__':
# keypair = genratePublicPrivateKey()
# keypair2 = genratePublicPrivateKey()
# print(keypair)
# print(keypair2)
print(pseudoRandomGenerator("abc"))
print(pseudoRandomGenerator("abc"))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment