mcdouglasx
Member
Offline
Activity: 343
Merit: 93
New ideas will be criticized and then admired.
|
|
September 03, 2023, 05:33:15 PM Last edit: September 03, 2023, 05:53:08 PM by mcdouglasx |
|
a mathematical curiosity that maybe could help the puzzle: all numbers even that respects this succession 4,10,16,22,28,34,40,46.....To infinity divided by 3 plus the sum of +1 to the same number divided by 3, results in an integer, odd number. target = 100 target_2 = 100+1 #= 101
t1= target//3 #= 33.333333333333336 t2= target_2//3 #= 33.666666666666664
r= t1+t2 # = 67 ---snipp--- t1 = t2 = 33 r will not result in 67 as you said, r=66 33.333333333333336+33.666666666666664 = 67 use 1 "/" symbol, 2 " //" is for rounding, sorry. even if you run the script it gives you like pk decimal=67 03df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f edit and if you subtract 100-67= 33 you would get the division of 100/3 rounded to 33.
|
BTC bc1qxs47ttydl8tmdv8vtygp7dy76lvayz3r6rdahu
|
|
|
Denis_Hitov
Newbie
Offline
Activity: 49
Merit: 0
|
|
September 03, 2023, 06:02:44 PM |
|
a mathematical curiosity that maybe could help the puzzle: all numbers even that respects this succession 4,10,16,22,28,34,40,46.....To infinity divided by 3 plus the sum of +1 to the same number divided by 3, results in an integer, odd number. target = 100 target_2 = 100+1 #= 101
t1= target//3 #= 33.333333333333336 t2= target_2//3 #= 33.666666666666664
r= t1+t2 # = 67 ---snipp--- t1 = t2 = 33 r will not result in 67 as you said, r=66 33.333333333333336+33.666666666666664 = 67 use 1 "/" symbol, 2 " //" is for rounding, sorry. even if you run the script it gives you like pk decimal=67 03df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f edit and if you subtract 100-67= 33 you would get the division of 100/3 rounded to 33. Unfortunately, this method does not work for all numbers: target = 150 target_2 = 150+1 #= 151 t1= target/3 #= 50 t2= target_2/3 #= 50.333333333333336 r= t1+t2 # = 100.333333333333336 150 − 100.333333333333336 = 49.666666666666664
|
|
|
|
james5000
Jr. Member
Offline
Activity: 69
Merit: 2
|
|
September 03, 2023, 06:07:41 PM |
|
Unfortunately, if the division results in a decimal number, the result will be incorrect.
|
|
|
|
citb0in
|
|
September 03, 2023, 06:16:59 PM |
|
33.333333333333336+33.666666666666664 = 67 use 1 "/" symbol, 2 " //" is for rounding, sorry.
in Python the // operator stands for floor division, that means it divides the first number by the second number and rounds the result down to the nearest integer.
|
_ _ _ __ _ _ _ __ |_) | / \ / |/ (_ / \ | \ / |_ |_) (_ |_) |_ \_/ \_ |\ __) \_/ |_ \/ |_ | \ __) --> citb0in Solo-Mining Group <--- low stake of only 0.001 BTC. We regularly rent about 5 PH/s hash power and direct it to SoloCK pool. Wanna know more? Read through the link and JOIN NOW
|
|
|
james5000
Jr. Member
Offline
Activity: 69
Merit: 2
|
|
September 03, 2023, 06:19:31 PM |
|
33.333333333333336+33.666666666666664 = 67 use 1 "/" symbol, 2 " //" is for rounding, sorry.
in Python the // operator stands for floor division, that means it divides the first number by the second number and rounds the result down to the nearest integer. It works for the private key, but what we have is the public key; in this case, Python doesn't round the result.
|
|
|
|
mcdouglasx
Member
Offline
Activity: 343
Merit: 93
New ideas will be criticized and then admired.
|
|
September 03, 2023, 06:51:12 PM |
|
33.333333333333336+33.666666666666664 = 67 use 1 "/" symbol, 2 " //" is for rounding, sorry.
in Python the // operator stands for floor division, that means it divides the first number by the second number and rounds the result down to the nearest integer. is just what I wanted to say. 33.333333333333336+33.666666666666664 = 67 use 1 "/" symbol, 2 " //" is for rounding, sorry.
in Python the // operator stands for floor division, that means it divides the first number by the second number and rounds the result down to the nearest integer. It works for the private key, but what we have is the public key; in this case, Python doesn't round the result. It's just what the script does (if the condition I wrote is met) a mathematical curiosity that maybe could help the puzzle: all numbers even that respects this succession 4,10,16,22,28,34,40,46.....To infinity divided by 3 plus the sum of +1 to the same number divided by 3, results in an integer, odd number. target = 100 target_2 = 100+1 #= 101
t1= target//3 #= 33.333333333333336 t2= target_2//3 #= 33.666666666666664
r= t1+t2 # = 67 ---snipp--- t1 = t2 = 33 r will not result in 67 as you said, r=66 33.333333333333336+33.666666666666664 = 67 use 1 "/" symbol, 2 " //" is for rounding, sorry. even if you run the script it gives you like pk decimal=67 03df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f edit and if you subtract 100-67= 33 you would get the division of 100/3 rounded to 33. Unfortunately, this method does not work for all numbers: target = 150 target_2 = 150+1 #= 151 t1= target/3 #= 50 t2= target_2/3 #= 50.333333333333336 r= t1+t2 # = 100.333333333333336 150 − 100.333333333333336 = 49.666666666666664 Why do you want to apply to a number that is division of 3? 150/3= 50
|
BTC bc1qxs47ttydl8tmdv8vtygp7dy76lvayz3r6rdahu
|
|
|
Denis_Hitov
Newbie
Offline
Activity: 49
Merit: 0
|
|
September 03, 2023, 07:26:14 PM Last edit: September 03, 2023, 08:21:08 PM by Denis_Hitov |
|
Why do you want to apply to a number that is division of 3? 150/3= 50
I took the number 150 just as an example. For example Puzzle #65: target = 30568377312064202855 target_2 = 30568377312064202855+1 #= 30568377312064202856 t1= target/3 #= 10189459104021400951.666666666666667 t2= target_2/3 #= 10189459104021400952 r= t1+t2 # = 20378918208042801903.666666666666667 30568377312064202855 − 20378918208042801903.666666666666667 = 10189459104021400951.333333333333333 I cannot understand how this method will help in solving the puzzle if the "target" is unknown to us.
|
|
|
|
james5000
Jr. Member
Offline
Activity: 69
Merit: 2
|
|
September 03, 2023, 08:47:36 PM |
|
Why do you want to apply to a number that is division of 3? 150/3= 50
I took the number 150 just as an example. For example Puzzle #65: target = 30568377312064202855 target_2 = 30568377312064202855+1 #= 30568377312064202856 t1= target/3 #= 10189459104021400951.666666666666667 t2= target_2/3 #= 10189459104021400952 r= t1+t2 # = 20378918208042801903.666666666666667 30568377312064202855 − 20378918208042801903.666666666666667 = 10189459104021400951.333333333333333 I cannot understand how this method will help in solving the puzzle if the "target" is unknown to us. I'm also quite curious about it.
|
|
|
|
digaran
Copper Member
Hero Member
Offline
Activity: 1330
Merit: 900
🖤😏
|
|
September 03, 2023, 09:54:29 PM |
|
5/3 = 1.66666666666666666666666666666666666666666666666666666666666666666666666666666 6666666666666666666666666666666666666666666666666666666666666666666666666666666 6666666666666666666666666666666666666666667
Puzzle 65/3 = 10189459104021400951.6666666666666666666666666666666666666666666666666666666666 6666666666666666666666666666666666666666666666666666666666666666666666666666666 6666666666666666666666666666666666666666667
Puzzle 65/333 =
91796928865057666.2312312312312312312312312312312312312312312312312312312312312 3123123123123123123123123123123123123123123123123123123123123123123123123123123 1231231231231231231231231231231231231231231
5/333 = 0.01501501501501501501501501501501501501501501501501501501501501501501501501501 5015015015015015015015015015015015015015015015015015015015015015015015015015015 015015015015015015015015015015015015015015015
Puzzle 65/9 = 3396486368007133650.55555555555555555555555555555555555555555555555555555555555 5555555555555555555555555555555555555555555555555555555555555555555555555555555 5555555555555555555555555555555555555555556
5/9 = 0.55555555555555555555555555555555555555555555555555555555555555555555555555555 5555555555555555555555555555555555555555555555555555555555555555555555555555555 55555555555555555555555555555555555555555556
5/27 = 0.18518518518518518518518518518518518518518518518518518518518518518518518518518 5185185185185185185185185185185185185185185185185185185185185185185185185185185 18518518518518518518518518518518518518518519
Puzzle 65/27 = 1132162122669044550.18518518518518518518518518518518518518518518518518518518518 5185185185185185185185185185185185185185185185185185185185185185185185185185185 1851851851851851851851851851851851851851852
Puzzle 65/999 = 30598976288352555.4104104104104104104104104104104104104104104104104104104104104 1041041041041041041041041041041041041041041041041041041041041041041041041041041 041041041041041041041041041041041041041041
5/999 = 0.00500500500500500500500500500500500500500500500500500500500500500500500500500 5005005005005005005005005005005005005005005005005005005005005005005005005005005 005005005005005005005005005005005005005005005
Puzzle 65/666 = 45898464432528833.1156156156156156156156156156156156156156156156156156156156156 1561561561561561561561561561561561561561561561561561561561561561561561561561561 5615615615615615615615615615615615615615616
5/666 = 0.00750750750750750750750750750750750750750750750750750750750750750750750750750 7507507507507507507507507507507507507507507507507507507507507507507507507507507 5075075075075075075075075075075075075075075075
Puzzle 65/18 = 1698243184003566825.27777777777777777777777777777777777777777777777777777777777 7777777777777777777777777777777777777777777777777777777777777777777777777777777 7777777777777777777777777777777777777777778
5/18 = 0.27777777777777777777777777777777777777777777777777777777777777777777777777777 7777777777777777777777777777777777777777777777777777777777777777777777777777777 77777777777777777777777777777777777777777778
Now ignore whatever you see before the dot "." Just look at whatever you see after the dot.😉 chop chop and good luck.
|
🖤😏
|
|
|
james5000
Jr. Member
Offline
Activity: 69
Merit: 2
|
|
September 03, 2023, 10:18:49 PM |
|
Why do you want to apply to a number that is division of 3? 150/3= 50
I took the number 150 just as an example. For example Puzzle #65: target = 30568377312064202855 target_2 = 30568377312064202855+1 #= 30568377312064202856 t1= target/3 #= 10189459104021400951.666666666666667 t2= target_2/3 #= 10189459104021400952 r= t1+t2 # = 20378918208042801903.666666666666667 30568377312064202855 − 20378918208042801903.666666666666667 = 10189459104021400951.333333333333333 I cannot understand how this method will help in solving the puzzle if the "target" is unknown to us. There are only three ways to divide any number by 3. I'll call them A B C. A= the normal division of the number. B= applying my script C= adding + 1 and dividing. Since you don't know what the pk is, you must apply A, B, C and one of the three will always be correct. So you want to apply another division of 3 to the result. you will get 9 pub one of them will be correct. and so on.. 3**X is the final amount of pubkeys where X is the number of times to divide the result (and of that result only one will be correct) I still can't understand where you're going with this.
|
|
|
|
james5000
Jr. Member
Offline
Activity: 69
Merit: 2
|
|
September 03, 2023, 10:20:38 PM |
|
I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
|
|
|
|
mcdouglasx
Member
Offline
Activity: 343
Merit: 93
New ideas will be criticized and then admired.
|
|
September 03, 2023, 10:34:23 PM Last edit: September 03, 2023, 10:51:00 PM by mcdouglasx |
|
I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
the problem of dividing by 2 is that you need 2**101 pubkeys (according to your approach). update: dividing by 3 you need 3**14 pubkeys, to reduce puzzle130 down to the equivalent of puzzle 105.
|
BTC bc1qxs47ttydl8tmdv8vtygp7dy76lvayz3r6rdahu
|
|
|
digaran
Copper Member
Hero Member
Offline
Activity: 1330
Merit: 900
🖤😏
|
|
September 03, 2023, 11:16:54 PM |
|
I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
the problem of dividing by 2 is that you need 2**101 pubkeys (according to your approach). update: dividing by 3 you need 3**14 pubkeys, to reduce puzzle130 down to the equivalent of puzzle 105. So reducing 25 bits, if dividing by 2 we need 2^25 public keys with 1 one of them to be the correct result, but dividing by 3 we need 3^14 keys, one of them would be correct, how did you calculate it? I hope your scrip saves the results to a file, because I only see print, are we supposed to print thousands of keys on screen? 😅 save us from this abomination!
|
🖤😏
|
|
|
mcdouglasx
Member
Offline
Activity: 343
Merit: 93
New ideas will be criticized and then admired.
|
|
September 03, 2023, 11:30:10 PM |
|
I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
the problem of dividing by 2 is that you need 2**101 pubkeys (according to your approach). update: dividing by 3 you need 3**14 pubkeys, to reduce puzzle130 down to the equivalent of puzzle 105. So reducing 25 bits, if dividing by 2 we need 2^25 public keys with 1 one of them to be the correct result, but dividing by 3 we need 3^14 keys, one of them would be correct, how did you calculate it? I hope your scrip saves the results to a file, because I only see print, are we supposed to print thousands of keys on screen? 😅 He says he wants to divide 101 times, and since he doesn't know the pk he needs to do pk/2 and ( pk-1)/2 which results in 2x2x2x2.... 101 times (2**101) by 3 is 3x3x3x3.... 14 times (3**14) equivalent to puzzle 105
|
BTC bc1qxs47ttydl8tmdv8vtygp7dy76lvayz3r6rdahu
|
|
|
digaran
Copper Member
Hero Member
Offline
Activity: 1330
Merit: 900
🖤😏
|
|
September 03, 2023, 11:33:05 PM |
|
I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
the problem of dividing by 2 is that you need 2**101 pubkeys (according to your approach). update: dividing by 3 you need 3**14 pubkeys, to reduce puzzle130 down to the equivalent of puzzle 105. So reducing 25 bits, if dividing by 2 we need 2^25 public keys with 1 one of them to be the correct result, but dividing by 3 we need 3^14 keys, one of them would be correct, how did you calculate it? I hope your scrip saves the results to a file, because I only see print, are we supposed to print thousands of keys on screen? 😅 He says he wants to divide 101 times, and since he doesn't know the pk he needs to do pk/2 and ( pk-1)/2 which results in 2x2x2x2.... 101 times (2**101) by 3 is 3x3x3x3.... 14 times (3**14) equivalent to puzzle 105 Ok, can you tell us where to put our target public key in your script, where to put the number of times etc, please?
|
🖤😏
|
|
|
mcdouglasx
Member
Offline
Activity: 343
Merit: 93
New ideas will be criticized and then admired.
|
|
September 04, 2023, 12:11:01 AM |
|
I'm not sure if it helps, but for 130 bits, we only need to divide the point by 2, 101 times. The issue is figuring out where to subtract 1 to avoid floating-point errors.
the problem of dividing by 2 is that you need 2**101 pubkeys (according to your approach). update: dividing by 3 you need 3**14 pubkeys, to reduce puzzle130 down to the equivalent of puzzle 105. So reducing 25 bits, if dividing by 2 we need 2^25 public keys with 1 one of them to be the correct result, but dividing by 3 we need 3^14 keys, one of them would be correct, how did you calculate it? I hope your scrip saves the results to a file, because I only see print, are we supposed to print thousands of keys on screen? 😅 He says he wants to divide 101 times, and since he doesn't know the pk he needs to do pk/2 and ( pk-1)/2 which results in 2x2x2x2.... 101 times (2**101) by 3 is 3x3x3x3.... 14 times (3**14) equivalent to puzzle 105 Ok, can you tell us where to put our target public key in your script, where to put the number of times etc, please? This script is just theory, not done to create massive continuous divisions, when I have time I'll do it.
|
BTC bc1qxs47ttydl8tmdv8vtygp7dy76lvayz3r6rdahu
|
|
|
digaran
Copper Member
Hero Member
Offline
Activity: 1330
Merit: 900
🖤😏
|
|
September 04, 2023, 03:36:57 AM |
|
It would be great, also note that you should calculate the result private key mod n, your current script returns the correct public key but not private key.
Only thing it needs is to accept public key as target. Amazing coding btw.👍, it's really joyful to see people are using their brains rather than giving up and quitting.
|
🖤😏
|
|
|
nomachine
Member
Offline
Activity: 502
Merit: 38
|
|
September 04, 2023, 09:44:15 AM Last edit: September 04, 2023, 10:26:10 AM by nomachine |
|
Also for checkpoint.txt I just need to paste x coordinates on one line per key and save their private keys? What else do I need to change on the script?
I appreciate it.
Edit, I got it running, I just need to know what to change for addition and subtraction, should I put values in decimal? And why it won't show anything on screen? Lol it just blinks endlessly.
Here is how to tune script as per your needs: 1. xy.txt file must have x and y coordinates in decimal format with a single space between them, as I clarified earlier. 2. In checkpoints.txt file you don't need to save their private keys, why? that is whole point, because we keep starting 100 million or 1 billion pub keys' x coordinates which will work as 2 billions, so it is obvious that their private keys are from 2 to 1 billion or the last 1 billion. 3. There are 3 things that you can change, step size to be subtracted, number of steps, and number of iterations. all these are in numbers not in points. 4. Finally, why script was blinking, is because it was loading checkpoints.txt file, In my case I had 8 GB RAM with around 5.5 GB checkpoints.txt file, on a dual core system. It was taking around half an hour before printing steps.... Be patient, if no error occur, it will start printing within half an hour. I was also able to update the existing code to utilize almost all available CPU in your machine though leaving space for other activities and it's now 10 times faster... from multiprocessing import Pool, cpu_count
Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 -1 # The proven prime N=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 # Number of points in the field Acurve = 0; Bcurve = 7 # These two defines the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240 Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424 GPoint = (Gx,Gy) # This is our generator point. Trillions of dif ones possible
def modinv(a, n=Pcurve): lm, hm = 1, 0 low, high = a % n, n while low > 1: ratio = high // low nm, new = hm - lm * ratio, high - low * ratio lm, low, hm, high = nm, new, lm, low return lm % n
def ECadd(a, b): if a == 'O': return b if b == 'O': return a if a == b: LamAdd = ((3 * a[0] * a[0] + Acurve) * modinv(2 * a[1], Pcurve)) % Pcurve else: LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], Pcurve)) % Pcurve x = (LamAdd * LamAdd - a[0] - b[0]) % Pcurve y = (LamAdd * (a[0] - x) - a[1]) % Pcurve return (x, y)
def ECsub(a, b): if b == 'O': return a if isinstance(a, str): a = tuple(map(int, a.split())) if isinstance(b, str): b = tuple(map(int, b.split())) neg_b = (b[0], -b[1] % Pcurve) return ECadd(a, neg_b)
def ECmul(a, b): result = 'O' while b > 0: if b % 2 == 1: result = ECadd(result, a) a = ECadd(a, a) b = b // 2 return result
# Read the x, y coordinates from xy.txt with open("xy.txt", "r") as f: x, y = map(int, f.read().strip().split()) point = (x, y)
# Read the checkpoint x-coordinates from checkpoints.txt with open("checkpoints.txt", "r") as f: checkpoints = set(map(int, f.read().strip().split()))
filename_out = "results.txt"
sub_count = 0
# read the last value of j from file try: with open("j_value.txt", "r") as f: last_j_value = int(f.readline()) except: last_j_value = 0
def process_iteration(args): j, last_j_value, point, checkpoints, filename_out = args found_match = False sub_count = 160000000 * j for k in range(100001): if k == 0: pass else: sub_count += 212676479325586539664609129644855 result = ECmul(GPoint, sub_count) result = ECsub(point, result) print(sub_count) if result[0] in checkpoints: with open(filename_out, "w") as f_out: subtractions = sub_count // 212676479325586539664609129644855 f_out.write("{} {} {}".format(result[0], result[1], subtractions)) found_match = True break return found_match
def main(): # Read the x, y coordinates from xy.txt with open("xy.txt", "r") as f: x, y = map(int, f.read().strip().split()) point = (x, y)
# Read the checkpoint x-coordinates from checkpoints.txt with open("checkpoints.txt", "r") as f: checkpoints = set(map(int, f.read().strip().split()))
filename_out = "results.txt"
# read the last value of j from file try: with open("j_value.txt", "r") as f: last_j_value = int(f.readline()) except: last_j_value = 0
# Determine the number of processes to use num_processes = min(cpu_count(), 8) # You can adjust the number of processes
args_list = [(j, last_j_value, point, checkpoints, filename_out) for j in range(last_j_value, 10000001)]
with Pool(processes=num_processes) as pool: results = pool.map(process_iteration, args_list)
if any(results): print("Found match!") else: print("No match found.")
if __name__ == "__main__": main()
All we need now is the checkpoint generation techniques to have enough checkpoints for the code to run even faster and maximize RAM usage You can use ecmultiply_memo to store the results of previously computed point multiplications in the elliptic curve group to compute the multiplication of a point a by an integer b. Memoization helps optimize the code by storing the results of ECmul in the ecmultiply_memo dictionary for a given a and b pair. The montgomery_ladder function takes the scalar k and point P as inputs and returns the result of the point multiplication k * P. It uses a loop that processes each bit of the scalar k and combines point additions and doublings to compute the final result. This algorithm is more efficient than the simple double-and-add method . Also gmpy2 to perform modinv even faster. Something like this : from multiprocessing import Pool, cpu_count import gmpy2
Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 - 1 # The proven prime N = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 # Number of points in the field Acurve = 0 Bcurve = 7 # These two define the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240 Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424 GPoint = (Gx, Gy) # This is our generator point. Trillions of different ones possible
def modinv(a, n=Pcurve): return int(gmpy2.invert(a, n))
ecmultiply_memo = {} # Memoization dictionary for ECmul
def ECadd(a, b): if a == 'O': return b if b == 'O': return a if a == b: LamAdd = ((3 * a[0] * a[0] + Acurve) * modinv(2 * a[1], Pcurve)) % Pcurve else: LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], Pcurve)) % Pcurve x = (LamAdd * LamAdd - a[0] - b[0]) % Pcurve y = (LamAdd * (a[0] - x) - a[1]) % Pcurve return (x, y)
def ECsub(a, b): if b == 'O': return a if isinstance(a, str): a = tuple(map(int, a.split())) if isinstance(b, str): b = tuple(map(int, b.split())) neg_b = (b[0], -b[1] % Pcurve) return ECadd(a, neg_b)
def ECmul(a, b): if a in ecmultiply_memo: return ecmultiply_memo[a] result = 'O' while b > 0: if b % 2 == 1: result = ECadd(result, a) a = ECadd(a, a) b = b // 2
ecmultiply_memo[a] = result return result
def montgomery_ladder(k, P): R0, R1 = 'O', P for i in range(k.bit_length()): if k & 1: R0, R1 = ECadd(R0, R1), ECmul(R0, R1) else: R0, R1 = ECmul(R0, R1), ECadd(R0, R1) k >>= 1 return R0
def process_iteration(args): j, last_j_value, point, checkpoints, filename_out = args found_match = False sub_count = 160000000 * j for k in range(100001): if k == 0: pass else: sub_count += 212676479325586539664609129644855 result = montgomery_ladder(sub_count, GPoint) # Use Montgomery ladder result = ECsub(point, result) print(sub_count) if result[0] in checkpoints: with open(filename_out, "w") as f_out: subtractions = sub_count // 212676479325586539664609129644855 f_out.write("{} {} {}".format(result[0], result[1], subtractions)) found_match = True break return found_match
def main(): # Read the x, y coordinates from xy.txt with open("xy.txt", "r") as f: x, y = map(int, f.read().strip().split()) point = (x, y)
# Read the checkpoint x-coordinates from checkpoints.txt with open("checkpoints.txt", "r") as f: checkpoints = set(map(int, f.read().strip().split()))
filename_out = "results.txt"
# read the last value of j from file try: with open("j_value.txt", "r") as f: last_j_value = int(f.readline()) except: last_j_value = 0
# Determine the number of processes to use num_processes = min(cpu_count(), 8) # You can adjust the number of processes
args_list = [(j, last_j_value, point, checkpoints, filename_out) for j in range(last_j_value, 10000001)]
with Pool(processes=num_processes) as pool: results = pool.map(process_iteration, args_list)
if any(results): print("Found match!") else: print("No match found.")
if __name__ == "__main__": main()
|
bc1qdwnxr7s08xwelpjy3cc52rrxg63xsmagv50fa8
|
|
|
modma
Newbie
Offline
Activity: 10
Merit: 0
|
|
September 04, 2023, 02:11:51 PM |
|
Now ignore whatever you see before the dot "." Just look at whatever you see after the dot.😉 chop chop and good luck.
I see a not very smart person who does not understand either mathematics or modular mathematics, but with all this with a crown on his head. your every post highlights your low level of intelligence. Ps it was offtopic. but still. Guys, where diagran is trying to take you does not make any sense. for subtraction, division, multiplication, etc. even if it reduces the search range for a key, it proportionally increases the number of searched keys. it all makes no sense. there is no difference to look for 1 key in range 2^130 or 4 in the range 2^128. in terms of the time spent by the currently known tools, you will spend the same amount of time.
|
|
|
|
jessica.roy
Newbie
Offline
Activity: 7
Merit: 0
|
|
September 04, 2023, 02:55:47 PM |
|
Also for checkpoint.txt I just need to paste x coordinates on one line per key and save their private keys? What else do I need to change on the script?
I appreciate it.
Edit, I got it running, I just need to know what to change for addition and subtraction, should I put values in decimal? And why it won't show anything on screen? Lol it just blinks endlessly.
Here is how to tune script as per your needs: 1. xy.txt file must have x and y coordinates in decimal format with a single space between them, as I clarified earlier. 2. In checkpoints.txt file you don't need to save their private keys, why? that is whole point, because we keep starting 100 million or 1 billion pub keys' x coordinates which will work as 2 billions, so it is obvious that their private keys are from 2 to 1 billion or the last 1 billion. 3. There are 3 things that you can change, step size to be subtracted, number of steps, and number of iterations. all these are in numbers not in points. 4. Finally, why script was blinking, is because it was loading checkpoints.txt file, In my case I had 8 GB RAM with around 5.5 GB checkpoints.txt file, on a dual core system. It was taking around half an hour before printing steps.... Be patient, if no error occur, it will start printing within half an hour. I was also able to update the existing code to utilize almost all available CPU in your machine though leaving space for other activities and it's now 10 times faster... from multiprocessing import Pool, cpu_count
Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 -1 # The proven prime N=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 # Number of points in the field Acurve = 0; Bcurve = 7 # These two defines the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240 Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424 GPoint = (Gx,Gy) # This is our generator point. Trillions of dif ones possible
def modinv(a, n=Pcurve): lm, hm = 1, 0 low, high = a % n, n while low > 1: ratio = high // low nm, new = hm - lm * ratio, high - low * ratio lm, low, hm, high = nm, new, lm, low return lm % n
def ECadd(a, b): if a == 'O': return b if b == 'O': return a if a == b: LamAdd = ((3 * a[0] * a[0] + Acurve) * modinv(2 * a[1], Pcurve)) % Pcurve else: LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], Pcurve)) % Pcurve x = (LamAdd * LamAdd - a[0] - b[0]) % Pcurve y = (LamAdd * (a[0] - x) - a[1]) % Pcurve return (x, y)
def ECsub(a, b): if b == 'O': return a if isinstance(a, str): a = tuple(map(int, a.split())) if isinstance(b, str): b = tuple(map(int, b.split())) neg_b = (b[0], -b[1] % Pcurve) return ECadd(a, neg_b)
def ECmul(a, b): result = 'O' while b > 0: if b % 2 == 1: result = ECadd(result, a) a = ECadd(a, a) b = b // 2 return result
# Read the x, y coordinates from xy.txt with open("xy.txt", "r") as f: x, y = map(int, f.read().strip().split()) point = (x, y)
# Read the checkpoint x-coordinates from checkpoints.txt with open("checkpoints.txt", "r") as f: checkpoints = set(map(int, f.read().strip().split()))
filename_out = "results.txt"
sub_count = 0
# read the last value of j from file try: with open("j_value.txt", "r") as f: last_j_value = int(f.readline()) except: last_j_value = 0
def process_iteration(args): j, last_j_value, point, checkpoints, filename_out = args found_match = False sub_count = 160000000 * j for k in range(100001): if k == 0: pass else: sub_count += 212676479325586539664609129644855 result = ECmul(GPoint, sub_count) result = ECsub(point, result) print(sub_count) if result[0] in checkpoints: with open(filename_out, "w") as f_out: subtractions = sub_count // 212676479325586539664609129644855 f_out.write("{} {} {}".format(result[0], result[1], subtractions)) found_match = True break return found_match
def main(): # Read the x, y coordinates from xy.txt with open("xy.txt", "r") as f: x, y = map(int, f.read().strip().split()) point = (x, y)
# Read the checkpoint x-coordinates from checkpoints.txt with open("checkpoints.txt", "r") as f: checkpoints = set(map(int, f.read().strip().split()))
filename_out = "results.txt"
# read the last value of j from file try: with open("j_value.txt", "r") as f: last_j_value = int(f.readline()) except: last_j_value = 0
# Determine the number of processes to use num_processes = min(cpu_count(), 8) # You can adjust the number of processes
args_list = [(j, last_j_value, point, checkpoints, filename_out) for j in range(last_j_value, 10000001)]
with Pool(processes=num_processes) as pool: results = pool.map(process_iteration, args_list)
if any(results): print("Found match!") else: print("No match found.")
if __name__ == "__main__": main()
All we need now is the checkpoint generation techniques to have enough checkpoints for the code to run even faster and maximize RAM usage You can use ecmultiply_memo to store the results of previously computed point multiplications in the elliptic curve group to compute the multiplication of a point a by an integer b. Memoization helps optimize the code by storing the results of ECmul in the ecmultiply_memo dictionary for a given a and b pair. The montgomery_ladder function takes the scalar k and point P as inputs and returns the result of the point multiplication k * P. It uses a loop that processes each bit of the scalar k and combines point additions and doublings to compute the final result. This algorithm is more efficient than the simple double-and-add method . Also gmpy2 to perform modinv even faster. Something like this : from multiprocessing import Pool, cpu_count import gmpy2
Pcurve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 - 1 # The proven prime N = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 # Number of points in the field Acurve = 0 Bcurve = 7 # These two define the elliptic curve. y^2 = x^3 + Acurve * x + Bcurve Gx = 55066263022277343669578718895168534326250603453777594175500187360389116729240 Gy = 32670510020758816978083085130507043184471273380659243275938904335757337482424 GPoint = (Gx, Gy) # This is our generator point. Trillions of different ones possible
def modinv(a, n=Pcurve): return int(gmpy2.invert(a, n))
ecmultiply_memo = {} # Memoization dictionary for ECmul
def ECadd(a, b): if a == 'O': return b if b == 'O': return a if a == b: LamAdd = ((3 * a[0] * a[0] + Acurve) * modinv(2 * a[1], Pcurve)) % Pcurve else: LamAdd = ((b[1] - a[1]) * modinv(b[0] - a[0], Pcurve)) % Pcurve x = (LamAdd * LamAdd - a[0] - b[0]) % Pcurve y = (LamAdd * (a[0] - x) - a[1]) % Pcurve return (x, y)
def ECsub(a, b): if b == 'O': return a if isinstance(a, str): a = tuple(map(int, a.split())) if isinstance(b, str): b = tuple(map(int, b.split())) neg_b = (b[0], -b[1] % Pcurve) return ECadd(a, neg_b)
def ECmul(a, b): if a in ecmultiply_memo: return ecmultiply_memo[a] result = 'O' while b > 0: if b % 2 == 1: result = ECadd(result, a) a = ECadd(a, a) b = b // 2
ecmultiply_memo[a] = result return result
def montgomery_ladder(k, P): R0, R1 = 'O', P for i in range(k.bit_length()): if k & 1: R0, R1 = ECadd(R0, R1), ECmul(R0, R1) else: R0, R1 = ECmul(R0, R1), ECadd(R0, R1) k >>= 1 return R0
def process_iteration(args): j, last_j_value, point, checkpoints, filename_out = args found_match = False sub_count = 160000000 * j for k in range(100001): if k == 0: pass else: sub_count += 212676479325586539664609129644855 result = montgomery_ladder(sub_count, GPoint) # Use Montgomery ladder result = ECsub(point, result) print(sub_count) if result[0] in checkpoints: with open(filename_out, "w") as f_out: subtractions = sub_count // 212676479325586539664609129644855 f_out.write("{} {} {}".format(result[0], result[1], subtractions)) found_match = True break return found_match
def main(): # Read the x, y coordinates from xy.txt with open("xy.txt", "r") as f: x, y = map(int, f.read().strip().split()) point = (x, y)
# Read the checkpoint x-coordinates from checkpoints.txt with open("checkpoints.txt", "r") as f: checkpoints = set(map(int, f.read().strip().split()))
filename_out = "results.txt"
# read the last value of j from file try: with open("j_value.txt", "r") as f: last_j_value = int(f.readline()) except: last_j_value = 0
# Determine the number of processes to use num_processes = min(cpu_count(), 8) # You can adjust the number of processes
args_list = [(j, last_j_value, point, checkpoints, filename_out) for j in range(last_j_value, 10000001)]
with Pool(processes=num_processes) as pool: results = pool.map(process_iteration, args_list)
if any(results): print("Found match!") else: print("No match found.")
if __name__ == "__main__": main()
While I may not be proficient in mathematical terms, I'm certainly willing to give it a try.
|
|
|
|
|