Author

Topic: feedback on the position of two secp256k1 public keys (Read 79 times)

newbie
Activity: 27
Merit: 4
Hey guys I'm trying to develop a feedback system on the position of two secp256k1 public keys. and based on what I have tried the best feedback is the ETA. for example if the time taken to reach from 100 to 1 is 5 minuets it should be 2.5 minuets for 50 to go to 1 if I get the public keys and it is true if the 100 becomes grater and the ETA changes.

Here is something that I tried but didn't work, not sure why it didn't work. I would greatly appreciate if someone could point me at the right direction if I'm on the wrong side :-)

So here is the steps I followed :

Convert Public Keys to Coordinates: The public keys you've provided are in hexadecimal format. You'll need to convert them to coordinates on the elliptic curve (x, y).

Perform Point Comparison: Compare the x-coordinates of the two public keys to determine if they represent the same point on the secp256k1 elliptic curve. If the x-coordinates are the same, it's highly likely they correspond to the same public key.

Measure Execution Time: To measure the time taken for the comparison, you can use a programming language with libraries for working with elliptic curves like Python or a specialized cryptography library like OpenSSL. You will need to use functions for secp256k1 point comparison and time measurement.

Here's a Python code example using the pycoin library for comparing two secp256k1 public keys and measuring the time it takes:

Code:
import time
from pycoin.ecdsa import generator_secp256k1
from pycoin.encoding import sec_to_public_pair

# Public keys in hexadecimal format
hex_pubkey1 = "02ed3bace23c5e17652e174c835fb72bf53ee306b3406a26890221b4cef7500f88"
hex_pubkey2 = "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"

# Convert public keys to coordinates
point1 = sec_to_public_pair(bytes.fromhex(hex_pubkey1))
point2 = sec_to_public_pair(bytes.fromhex(hex_pubkey2))

# Measure execution time
start_time = time.time()

# Compare the x-coordinates of the points
if point1[0] == point2[0]:
    print("The public keys are the same.")
else:
    print("The public keys are different.")

end_time = time.time()
execution_time = end_time - start_time
print(f"Execution time: {execution_time} seconds")

This code converts the public keys to coordinates and then compare their x-coordinates. It will print whether the public keys are the same or different and also display the execution time.
Jump to: