From 95f2931d541df57b2d46acb46d5306d7b6dcf405 Mon Sep 17 00:00:00 2001 From: mjalalzai <33738574+MForensic@users.noreply.github.com> Date: Mon, 28 Aug 2023 13:34:49 -0700 Subject: [PATCH] Signature verification cost of committee_size vs dept --- scripts/authenticator_cost.py | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/scripts/authenticator_cost.py b/scripts/authenticator_cost.py index de475f2..d4b975d 100644 --- a/scripts/authenticator_cost.py +++ b/scripts/authenticator_cost.py @@ -1,13 +1,12 @@ import time -import ecdsa +import ed25519 def verify_signatures(committee_size, depth): # Simulate verifying depth * committee_size signatures start_time = time.time() - # ECDSA key generation - private_key = ecdsa.SigningKey.generate() - public_key = private_key.get_verifying_key() + # Generate a single EdDSA key pair for verification + private_key, public_key = ed25519.create_keypair() # Simulate depth * committee_size signature verifications for _ in range(depth * committee_size): @@ -19,25 +18,3 @@ def verify_signatures(committee_size, depth): elapsed_time = end_time - start_time return elapsed_time - - -def aggregate_signatures(committee_size): - # Simulate aggregating 3 * committee_size signatures - start_time = time.time() - - # ECDSA key generation - private_keys = [ecdsa.SigningKey.generate() for _ in range(3 * committee_size)] - # public_keys = [private_key.get_verifying_key() for private_key in private_keys] - - # Simulate signature aggregation - shared_message = b"Shared message to be signed" - signatures = [private_key.sign(shared_message) for private_key in private_keys] - aggregated_signature = sum(signatures, ecdsa.util.numbertheory.ordercurve.order) - - # Verify aggregated signature against the shared message - public_key = ecdsa.VerifyingKey.from_public_point(aggregated_signature, curve=ecdsa.SECP256k1) - assert public_key.verify(aggregated_signature, shared_message) - - end_time = time.time() - elapsed_time = end_time - start_time - return elapsed_time