Hello everyone,
I would like to present a challenge to the forum participants.
Consider the following constant:
0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1
The challenge is: given a random private key, can you determine whether the key is greater than or less than this constant?
Importantly, this is not about random guessing (50% probability), but about whether there exists a mathematical or cryptographic logic that allows one to consistently and correctly determine the result.
To make the challenge clearer:
Suppose 100 such comparison problems are given.
Is there anyone who can answer all 100 correctly without relying on random chance?
The purpose of this challenge is twofold:
To check if there exists any known logic or method to solve such problems consistently.
To confirm whether, according to current knowledge, this task is impossible without random guessing.
If you believe a method exists, please share your reasoning or approach. If you believe it is impossible, your confirmation would also be valuable.
Thank you for your thoughts and participation.
import random
import ecdsa
import binascii
# Generate random values for the test
# a and b are private keys (a > b by a fixed amount), and they can be positive or negative
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
# Store challenge public key pairs
public_keys_by_iteration = []
# Generate 100 randomized test pairs
for i in range(1, 101):
a, b, am, pma, pmb = generate_random_values()
# --- INTERNAL USE (scoring reference) ---
# These are for internal grading only, not to be shared outside.
# print("a:", a)
# print("b:", b)
# print("am:", am)
# print("pma (Private Key a):", pma)
# print("pmb (Private Key b):", pmb)
# Generate public keys
_, public_key_a_compressed = generate_public_key(pma)
_, public_key_b_compressed = generate_public_key(pmb)
# --- INTERNAL SIGN CHECK (not shared) ---
adjusted_pma = get_adjusted_value(pma)
if adjusted_pma < threshold:
sign_label = "+"
else:
sign_label = "-"
# print("pma sign:", sign_label)
# Store compressed keys for challenge
public_keys_by_iteration.append([public_key_a_compressed, public_key_b_compressed])
# --- 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)