import gmpy2 as mpz
from gmpy2 import powmod
# Define the ec_operations function
def ec_operations(start_range, end_range, scalar_1, scalar_2, n, divide_1_by_odd=True, divide_1_by_even=True, divide_2_by_odd=True, divide_2_by_even=True):
for i in range(start_range + (start_range%2), end_range, 2):
# divide scalar 1 by odd or even numbers
if i%2 == 0 and not divide_1_by_even:
continue
elif i%2 == 1 and not divide_1_by_odd:
continue
try:
# calculate inverse modulo of i
i_inv = powmod(i, n-2, n)
# multiply the scalar targets by i modulo n
result_1 = scalar_2 * i_inv % n
result_2 = scalar_1 * i_inv % n
# divide scalar 2 by odd or even numbers
if i%2 == 0 and not divide_2_by_even:
continue
elif i%2 == 1 and not divide_2_by_odd:
continue
# subtract the results
sub_result = (result_2 - result_1) % n
# print results separately
(f"{hex(result_1)[2:]}")
(f"{hex(result_2)[2:]}")
print(f"{i}-{hex(sub_result)[2:]}")
except ZeroDivisionError:
pass
if __name__ == "__main__":
# Set the targets and range for the operations
scalar_1 = 0x000000000000000000000000000000000000000af55fc59c335c8ec67e66df97
scalar_2 = 0x000000000000000000000000000000000000000af55fc59c335c8ec67e66df8b
n = mpz.mpz("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141")
start_range = 2
end_range = 257
ec_operations(start_range, end_range, scalar_1, scalar_2, n)
I always wondered when I work with target +1, 2, 3 etc what would be the results, so now I need to wonder no more. There are some interesting results when we start adding to our target and then divide.
In the script above, if you start by scalar_1 +1 without changing scalar_2, running the script and only look at keys similar to n/2, n/4, n/6 etc, then keep adding to scalar_1 and run again to see where those n/? values appear.
Note that when we don't know the actual 2 targets, we can always know the resulting keys, but when we change one target with a known key, then knowing the resulting keys would solve the key for us, that's what is needed, however there are ways and tricks to hit one previously unknown key in one of the new results if we keep changing our known key at scalar_1 or 2.
Something to work with.
Let scalar_1 be : 0x000000000000000000000000000000000000000af55fc59c335c8ec67e66df8b
Subtract this from it : af00000000000000000000000
Result: put at scalar_2
0x0000000000000000000000000000000000000000055fc59c335c8ec67e66df8b
Now run and see the results, you will see af00000000000000000000000 being divided, so whatever we subtract from our target ( scalar_1 ), the results of script above will show us that number being divided even if we don't know it's key.
Now since we can always know the resulting keys as long as the 2 targets are unknown and we already know the distance between them, but now I'm interested to find out more.
Example:
Subtracting this from puzzle 130,
0000000000000000000000000000000400000000000000000000000000000000
Result: (offset1)
0308360beeb0177961b04eccc33decdf63e23d205abc8ef6355d659d1313459ba7
Subtracting above from #130, result : (offset2)
0283aac9d18b994b94c0d267921573958682a061d033e89d2b0c4614c760755e60
Now what if we use offset1 and offset2 as our targets and do the divide and sub like the script above? If we could find a known key in the results, we can solve #130, or any private key. 😉
Chop chop, don't just stare and forget, also remember when you find the solution to solve any key, if you like your head to stay on your shoulders, hands off the people's coins. ey 😉