A private key is an integer and your constant is also an integer so you can perform a simple comparison to see which one is bigger. But if by "the key" you mean the "public key" then it is impossible because as it was mentioned the whole underlying cryptography would have been deemed broken and people would have been able to start solving the ECDLP!
Fair enough You have a good point. A private key is just a gigantic number so comparing it to another number is kinda straightforward. But a public key isn't a number it's more like a point on a specific mathematical curve. Think of it like comparing a number to a physical street address they are fundamentally different kinds of data.
it's easy to get from your private key (the number) to your public key (the point on the curve), but it's computationally impossible to go back. If you could somehow compare a public key to an integer in a way that gave you a clue about the original private key you basically would have just turned that one way street into a two way street and the whole system would crumble.
It is not possible to reverse all public keys, but with my special program, I can determine 100% whether the result is "over" or "under." Please try creating a challenge. After running the program, just post the part of the output starting from
--- Public Keys for Each Challenge ---
and I will predict whether it is "over" or "under" within one hour.
I want to emphasize once again: not every public key in existence can be solved, but with the program I provided, it seems possible to do so.
import random
import ecdsa
import binascii
# Generate random values for the test
def generate_random_values():
a = random.randint(2**134, 2**135) # random large number (134~135 bits)
am = 10**37 # fixed delta between a and b
b = a - am
# Randomly assign positive or negative sign
sign = random.choice([1, -1])
pma = sign * a # signed private key a
pmb = sign * b # signed private key b
return a, b, am, pma, pmb
# Order of the secp256k1 curve (Bitcoin/Ethereum)
N = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
# Generate public key from a given (signed) private key
def generate_public_key(private_key_int):
private_key_bytes = abs(private_key_int).to_bytes(32, byteorder="big", signed=True)
sk = ecdsa.SigningKey.from_string(private_key_bytes, curve=ecdsa.SECP256k1)
vk = sk.verifying_key
# Uncompressed public key (0x04 + x + y)
public_key_bytes_uncompressed = b"\x04" + vk.to_string()
# Compressed public key (0x02 / 0x03 prefix)
if private_key_int < 0:
public_key_bytes_compressed = (
b"\x03" + vk.to_string()[:32] if vk.to_string()[-1] % 2 == 0 else b"\x02" + vk.to_string()[:32]
)
else:
public_key_bytes_compressed = (
b"\x02" + vk.to_string()[:32] if vk.to_string()[-1] % 2 == 0 else b"\x03" + vk.to_string()[:32]
)
return (
binascii.hexlify(public_key_bytes_uncompressed).decode(),
binascii.hexlify(public_key_bytes_compressed).decode()
)
# Threshold for sign determination
threshold = 0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1
# Adjust for negative keys (mod N)
def get_adjusted_value(key_int):
return key_int if key_int >= 0 else N + key_int
# Transformed pma value (if negative then N - abs(pma))
def transform_pma(pma):
return pma if pma >= 0 else N - abs(pma)
# Store challenge public key pairs
public_keys_by_iteration = []
answers = [] # store correct answers
# Generate 100 randomized test pairs
for i in range(1, 101):
a, b, am, pma, pmb = generate_random_values()
# --- INTERNAL USE (scoring reference) ---
print("a:", a)
print("b:", b)
print("am:", am)
print("pma (transformed):", transform_pma(pma)) # modified output
print("pmb:", transform_pma(pmb))
# Generate public keys
_, public_key_a_compressed = generate_public_key(pma)
_, public_key_b_compressed = generate_public_key(pmb)
# --- INTERNAL SIGN CHECK ---
adjusted_pma = get_adjusted_value(pma)
if adjusted_pma < threshold:
sign_label = "under" # "under" instead of "+"
else:
sign_label = "over" # "over" instead of "-"
answers.append(sign_label)
# Store compressed keys for challenge
public_keys_by_iteration.append([public_key_a_compressed, public_key_b_compressed])
# --- INTERNAL OUTPUT: Answer Sheet ---
print("\n--- Answer Sheet (Internal Use Only) ---")
for i in range(0, len(answers), 10):
line = " ".join(f"{i+j+1}={answers[i+j]}" for j in range(10) if i+j < len(answers))
print(line)
# --- PUBLIC OUTPUT: Challenge only ---
print("\n--- Public Keys for Each Challenge ---")
for idx, keys in enumerate(public_keys_by_iteration, start=1):
print(f"\nChallenge {idx}:")
for key in keys:
print(key)