Skip to content

Commit

Permalink
Create digital_signatures.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Nov 26, 2024
1 parent c18d0a7 commit 71cf781
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions QuantumNexusProtocol/src/cryptography/digital_signatures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from ecdsa import SigningKey, VerifyingKey, SECP256k1

class DigitalSignature:
def __init__(self):
self.sk = SigningKey.generate(curve=SECP256k1)
self.v k = self.sk.get_verifying_key()

def sign(self, message):
return self.sk.sign(message)

def verify(self, message, signature):
return self.vk.verify(signature, message)

# Example usage
if __name__ == "__main__":
message = b"Digital signature message"
ds = DigitalSignature()
signature = ds.sign(message)
is_valid = ds.verify(message, signature)
print(f"Signature valid: {is_valid}")

0 comments on commit 71cf781

Please sign in to comment.