I have digaran on ignore but it seems I see him again posting under the new user account mabdlmonem, humm?
It really reminds me of his additions/subtractions
|
|
|
Python def point_addition(p, q, a, p_curve): if p == "infinity": return q if q == "infinity": return p
x_p, y_p = p x_q, y_q = q
if p != q: m = ((y_q - y_p) * pow(x_q - x_p, -1, p_curve)) % p_curve else: m = ((3 * x_p**2 + a) * pow(2 * y_p, -1, p_curve)) % p_curve
x_r = (m**2 - x_p - x_q) % p_curve y_r = (m * (x_p - x_r) - y_p) % p_curve
return (x_r, y_r)
# Elliptic curve parameters p_curve = 2**256 - 2**32 - 2**9 - 2**8 - 2**7 - 2**6 - 2**4 - 1 a_curve = 0 g_basepoint = ( 55066263022277343669578718895168534326250603453777594175500187360389116729240, 32670510020758816978083085130507043184471273380659243275938904335757337482424 )
# Alice's private and public keys alice_private_key = 17436825491055586112755527818298542034755947930418580382030036978914692463183 alice_public_key = ( 105679268965026450260338478364512614840272341529552480851333141374575362812020, 16626610969520910407950657067133267950619549449019363437330088722436240164467 )
# Bob's private and public keys bob_private_key = 32291818723468099298317452759803795679231875044644200373977689553806184529332 bob_public_key = ( 91972152888645730114115627070016955368567223430226022010551427574648772204461, 38446745167120461740412855329188667802416705205856357237503216472671667494148 )
# Calculate (Alice Private + Bob Private) mod p combined_private_key = (alice_private_key + bob_private_key) % p_curve
# Calculate combined public key combined_public_key = "infinity" for i in range(combined_private_key.bit_length()): if (combined_private_key >> i) & 1: combined_public_key = point_addition(combined_public_key, g_basepoint, a_curve, p_curve)
print("(Alice Private + Bob Private) * G:", combined_public_key) print("Alice Public + Bob Public:", point_addition(alice_public_key, bob_public_key, a_curve, p_curve)) Result: (Alice Private + Bob Private) * G: (42781960159024299958163639356878453190501432691827926213851649420102986506453, 26209845635735715128050436215405957538148584136159453271268754283021438363749) Alice Public + Bob Public: (101985652621362431772155823262934243650512147323486167826619770748482854554391, 55338466074231142921426831718703469030196983642662166495910251269532062902125) This is off-topic and not directly related to brute-forcing Bitcoin (BTC). The focus here is on brute-forcing (trial-and-error guessing) BTC puzzles. And this code is demonstration of elliptic curve cryptography operations (a combined public key from the sum of two private keys) rather than an attempt to crack or exploit BTC. There doesn't appear to be any straightforward way to solve the presented challenge without resorting to years of brute force.
|
|
|
It's the same idea, it generate public from private then compare. It's not public key addition
And how else do you imagine generating a public key for a specific range, with a glass ball by magic? The problem is that we don't know any public keys. Except the Puzzle 130 and above...
|
|
|
Thank you, but that is not what I asked for, I asked about script for public key
Public key ?? Here you go (but you must know the target public key)........ puzzle 65 import sys, secrets, secp256k1 as ice while True: A0 = secrets.SystemRandom().randrange(18446744073709551615, 36893488147419103231) A1 = ice.scalar_multiplication(A0);B0 = ice.to_cpub(A1.hex()) message = "\r{}".format(B0);messages = [] messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r" sys.stdout.write(output);sys.stdout.flush() if B0 == "0230210c23b1a047bc9bdbb13448e67deddc108946de6de639bcc75d47c0216b1b": HEX = "%064x" % A0;wifc = ice.btc_pvk_to_wif(HEX) with open("KEYFOUNDKEYFOUND.txt", "a") as f: f.write(f'Private key (wif) Compressed : {wifc}\n') break
|
|
|
Hello all, is there any python code for public key addition and checking it's hash ?
Yes, look at the iceland2k14/secp256k1 script and create your script to fit within his script. Also, what do you mean by "checking it's hash"? H160? Yes , hash160 . I saw his code , I am just good at math but very bad at programming so I couldn't understand the code honestly Simplest import sys, secrets, secp256k1 as ice while True: dec = secrets.SystemRandom().randrange(36893488147419103231, 73786976294838206463) h160 = ice.privatekey_to_h160(0, True, dec).hex() message = "\r{}".format(h160);messages = [] messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r" sys.stdout.write(output);sys.stdout.flush() if h160 == "20d45a6a762535700ce9e0b216e31994335db8a5": HEX = "%064x" % dec;wifc = ice.btc_pvk_to_wif(HEX) with open("KEYFOUNDKEYFOUND.txt", "a") as f: f.write(f'Private key (wif) Compressed : {wifc}\n') break
|
|
|
Thanks, are you willing to work with mc together? I will give you a few ideas and methods, you two collaborate and make something that could actually solve a key, I have several promising methods, but they require many tweaking and might even be complicated, I'm doing it manually which takes time, I think you two are up to this task and I totally trust that you will do the right thing.
When you figured it out, encrypt a message containing the method with satoshi's first public key aka genesis public key and publish it here. Nobody else can be trusted other than him.😉
I don't even know what to do with the excess of my own ideas.
|
|
|
@nomachine, do we need to change seed for #66? I found 30 on mobile in 30 seconds, lol now we can compare a phone with a pc.
Of course you should. Each puzzle has a separate seed that needs to be discovered. It's best to start with: constant_prefix = b'' but you can start with constant_prefix = b'\xc9\xd9\x1d\xbc' to try luck (seed for 65 starts like that) the script itself generates the additional number of bytes to the required length increasingly I think the length is bits/8 or length = (puzzle//8) I have the most hits that way
|
|
|
The only promising code I have seen in a long time is the one mc posted, searching for either 02, or 03 public keys, if it was 02, ignore and discard, if it was 03, generate rmd160 to compare. That's the half of key space.
search for "02" or "03" and we would be dividing the area into 4. but it's lucky that you find the right combination I have that option in this script. You can change as you like: public_key_hex = ('02' and '03' if compressed else '04') + format(public_key[0], '064x') '02' and '03' together public_key_hex = ('02' or '03' if compressed else '04') + format(public_key[0], '064x') '02' or '03' / '03' or '02' public_key_hex = ('02' if compressed else '04') + format(public_key[0], '064x') only '02' public_key_hex = ('03' if compressed else '04') + format(public_key[0], '064x') only '03' No secp256k1 as ice, no ecdsa here.... Even encode base58 is custom with mpz. And it's not slower than iceland - it's the same... import hashlib, sys, os, time, random, gmpy2 from functools import lru_cache
# Constants as mpz Gx = gmpy2.mpz('0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798', 16) Gy = gmpy2.mpz('0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8', 16) p = gmpy2.mpz('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F', 16) n = gmpy2.mpz('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141', 16)
@lru_cache(maxsize=None) def private_key_to_public_key(private_key): Q = point_multiply(Gx, Gy, private_key, p) return Q
def point_multiply(x, y, k, p): result = (gmpy2.mpz(0), gmpy2.mpz(0)) addend = (x, y) while k > 0: if k & 1: result = point_add(result, addend, p) addend = point_double(addend, p) k >>= 1
return result
def point_double(point, p): x, y = point lmbda = (3 * x * x * gmpy2.powmod(2 * y, -1, p)) % p x3 = (lmbda * lmbda - 2 * x) % p y3 = (lmbda * (x - x3) - y) % p return x3, y3
def point_add(point1, point2, p): x1, y1 = point1 x2, y2 = point2
if point1 == (gmpy2.mpz(0), gmpy2.mpz(0)): return point2 if point2 == (gmpy2.mpz(0), gmpy2.mpz(0)): return point1
if point1 != point2: lmbda = ((y2 - y1) * gmpy2.powmod(x2 - x1, -1, p)) % p else: lmbda = ((3 * x1 * x1) * gmpy2.powmod(2 * y1, -1, p)) % p
x3 = (lmbda * lmbda - x1 - x2) % p y3 = (lmbda * (x1 - x3) - y1) % p return x3, y3
def encode_base58(byte_str): __b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' __b58base = len(__b58chars) long_value = gmpy2.mpz(int.from_bytes(byte_str, byteorder='big')) result = '' while long_value >= __b58base: div, mod = gmpy2.f_divmod(long_value, __b58base) result = __b58chars[int(mod)] + result long_value = div result = __b58chars[int(long_value)] + result
# Add leading '1's for zero bytes nPad = 0 for byte in byte_str: if byte == 0: nPad += 1 else: break
return __b58chars[0] * nPad + result
def public_key_to_hex(public_key, compressed=True): x_hex = format(public_key[0], '064x')[2:] # Remove '0x' prefix if compressed: return ('02' if public_key[1] % 2 == 0 else '03') + x_hex
def public_key_to_address(public_key, compressed=True): public_key_hex = ('02' and '03' if compressed else '04') + format(public_key[0], '064x') sha256_hash = hashlib.sha256(bytes.fromhex(public_key_hex)).digest() ripemd160_hash = hashlib.new('ripemd160', sha256_hash).digest() versioned_hash = (b'\x00' if compressed else b'\x04') + ripemd160_hash checksum = hashlib.sha256(hashlib.sha256(versioned_hash).digest()).digest()[:4] address_bytes = versioned_hash + checksum return encode_base58(address_bytes)
# Configuration for the puzzle puzzle = 30 add = '1LHtnpd8nU5VHEMkG2TMYYNUjjLc992bps' lower_range_limit = 2 ** (puzzle - 1);upper_range_limit = (2 ** puzzle) - 1 if os.name=='nt':os.system('cls') else:os.system('clear') t = time.ctime();sys.stdout.write(f"\033[?25l");sys.stdout.write(f"\033[01;33m[+] STARTED: {t}\n") sys.stdout.write(f"[+] Puzzle: {puzzle}\n") sys.stdout.write(f"[+] Lower range limit: {lower_range_limit}\n") sys.stdout.write(f"[+] Upper range limit: {upper_range_limit}\n")
while True: constant_prefix = b'yx\xcb\x08\xb70' prefix_length = len(constant_prefix);length = 8 ending_length = length - prefix_length;ending_bytes = os.urandom(ending_length) random_bytes = constant_prefix + ending_bytes random.seed(random_bytes) key = random.randint(lower_range_limit, upper_range_limit) public_key = private_key_to_public_key(key) bitcoin_address = public_key_to_address(public_key, compressed=True) public_key = public_key_to_hex(public_key) message = "[+] {}".format(key);messages = [];messages.append(message);output = ''.join(messages) + "\r";sys.stdout.write(output);sys.stdout.flush() if bitcoin_address == add: t = time.ctime() sys.stdout.write("\n") sys.stdout.write(f"\033[01;32m[+] SOLVED: {t}\n[+] Private Key (dec): {key}\n[+] Random Seed: {random_bytes}\033[0m\n") with open('KEYFOUNDKEYFOUND.txt', 'a') as file: file.write(f"Private Key (dec): {key}\nBitcoin Address (Compressed): {bitcoin_address}\nPublic Key: {public_key}\nRandom Seed: {random_bytes}\n\n") break - STARTED: Sat Nov 25 16:05:19 2023
- Puzzle: 30
- Lower range limit: 536870912
- Upper range limit: 1073741823
- 1033162084
- SOLVED: Sat Nov 25 16:05:21 2023
- Private Key (dec): 1033162084
|
|
|
It's time for new things.
I'm here for it! Is this where I get my cape and superhero mask for the new adventure?
|
|
|
The only promising code I have seen in a long time is the one mc posted, searching for either 02, or 03 public keys, if it was 02, ignore and discard, if it was 03, generate rmd160 to compare. That's the half of key space.
You can combine that method together with seed search. Seed can be found even faster. There is NO limitation in terms of what can be added as an automation of this process. import time, random, sys, os, secp256k1 as ice puzzle = 65 target_h160 = "52e763a7ddc1aa4fa811578c491c1bc7fd570137" lower_range_limit = 2 ** (puzzle - 1);upper_range_limit = (2 ** puzzle) - 1 while True: constant_prefix = b'' prefix_length = len(constant_prefix);length = 9 #let's play with 9 ending_length = length - prefix_length;ending_bytes = os.urandom(ending_length) random_bytes = constant_prefix + ending_bytes random.seed(random_bytes) dec = random.randint(lower_range_limit, upper_range_limit) A1 = ice.scalar_multiplication(dec) B0 = ice.to_cpub(A1.hex()) if B0.startswith("02"): #"02" for Puzzle 65 if str(dec).startswith("30568377"): message = "\r[+] {} , {}".format(dec, random_bytes);messages = [] messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r" sys.stdout.write(output);sys.stdout.flush() h160 = ice.privatekey_to_h160(0, True, dec).hex() if h160 == target_h160: HEX = "%064x" % dec;wifc = ice.btc_pvk_to_wif(HEX);t = time.ctime() print(f'[+] SOLVED: {t}') print(f'[+] Private key (wif) Compressed: {wifc}');print(f'[+] Random Seed: {random_bytes}') break
|
|
|
I am currently working on a method that allows you to find a key in bit30 in less than 10 seconds
Just 10 seconds? Here's a script that does it in 2 seconds. In Python. import time, random, sys, os, secp256k1 as ice puzzle = 30 target = "1LHtnpd8nU5VHEMkG2TMYYNUjjLc992bps" lower_range_limit = 2 ** (puzzle - 1);upper_range_limit = (2 ** puzzle) - 1 if os.name=='nt':os.system('cls') else:os.system('clear') t = time.ctime();sys.stdout.write(f"\033[?25l");sys.stdout.write(f"\033[01;33m[+] STARTED: {t}\n") sys.stdout.write(f"[+] Puzzle: {puzzle}\n") sys.stdout.write(f"[+] Lower range limit: {lower_range_limit}\n") sys.stdout.write(f"[+] Upper range limit: {upper_range_limit}\n") while True: constant_prefix = b'yx\xcb\x08\xb70' prefix_length = len(constant_prefix);length = 8 ending_length = length - prefix_length;ending_bytes = os.urandom(ending_length) random_bytes = constant_prefix + ending_bytes random.seed(random_bytes) dec = random.randint(lower_range_limit, upper_range_limit) caddr = ice.privatekey_to_address(0, True, dec) message = "\r[+] {}".format(dec);messages = [] messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r" sys.stdout.write(output);sys.stdout.flush() if caddr == target: HEX = "%064x" % dec;wifc = ice.btc_pvk_to_wif(HEX);t = time.ctime() print(f'[+] SOLVED: {t}');print(f'[+] Bitcoin address Compressed: {caddr}') print(f'[+] Private key (wif) Compressed: {wifc}');print(f'[+] Random Seed: {random_bytes}') break - STARTED: Sat Nov 25 05:07:51 2023
- Puzzle: 30
- Lower range limit: 536870912
- Upper range limit: 1073741823
- SOLVED: Sat Nov 25 05:07:52 2023
- Bitcoin address Compressed: 1LHtnpd8nU5VHEMkG2TMYYNUjjLc992bps
- Private key (wif) Compressed: KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M8diLSC5MyERoW
- Random Seed: b'yx\xcb\x08\xb70l\xf1'
nice code, this version goes 3 times faster import random, os, secp256k1 as ice puzzle = 30 #target = "1LHtnpd8nU5VHEMkG2TMYYNUjjLc992bps" target = "d39c4704664e1deb76c9331e637564c257d68a08" lower_range_limit = 2 ** (puzzle - 1);upper_range_limit = (2 ** puzzle) - 1 for x in range(1000000): constant_prefix = b'yx\xcb\x08\xb70' prefix_length = len(constant_prefix);length = 8 ending_length = length - prefix_length;ending_bytes = os.urandom(ending_length) random_bytes = constant_prefix + ending_bytes random.seed(random_bytes) dec = random.randint(lower_range_limit, upper_range_limit) caddr = ice.privatekey_to_h160(0, True, dec).hex() if caddr == target: print(caddr,dec) break The problem is that there has to be a method to find out what a random seed is. For each Puzzle i start from 0 - constant_prefix = b'' for x in range won't work above puzzle 40 - it needs at least 200 million seeds to go through the script. For example here I am hunting random seed for Puzzle 65: import time, random, sys, os, secp256k1 as ice puzzle = 65 target = 30568377312064202855 lower_range_limit = 2 ** (puzzle - 1);upper_range_limit = (2 ** puzzle) - 1
while True: constant_prefix = b'\xc9\xd9\x1d\xbc\x16\x9d' prefix_length = len(constant_prefix);length = 8 ending_length = length - prefix_length;ending_bytes = os.urandom(ending_length) random_bytes = constant_prefix + ending_bytes random.seed(random_bytes) dec = random.randint(lower_range_limit, upper_range_limit) if str(dec).startswith("30568377"): message = "\r[+] {} , {}".format(dec, random_bytes);messages = [] messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r" sys.stdout.write(output);sys.stdout.flush() if dec == target: caddr = ice.privatekey_to_address(0, True, dec) HEX = "%064x" % dec;wifc = ice.btc_pvk_to_wif(HEX);t = time.ctime() print(f'[+] SOLVED: {t}');print(f'[+] Bitcoin address Compressed: {caddr}') print(f'[+] Private key (wif) Compressed: {wifc}');print(f'[+] Random Seed: {random_bytes}') break First you search for the seed with - constant_prefix = b'' - for the first 8 numbers - if str(dec).startswith("30568377") - then you write the result in the script itself - constant_prefix = b'\xc9\xd9\x1d\xbc\x16\x9d' Then you go to 10 (removing manually the last two bytes at the end) and so on until you hit full WIF. The closest I've come up to 2 ** 65 30568377238562584866, b'\xc9\xd9\x1d\xbc\x16\x9d\xdb\x86' But what if is not length = 8 ? can be 9, 10, 11 ....and so on What if hypothetically there is a common seed for all puzzles, let's say on the seed length = 28 ? I'll never know because I've never even attempted that length
|
|
|
ok, delete the "while true:" and write "for i in range(1,20480):" Then tell me if your search is more effective.
This is not the way how random seed can be hacked. .
import secp256k1 as ice import random
print("scaning pub 03...")
target = "13zb1hQbWVsc2S7ZTZnP2G4undNNpdh5so"
start= 50000000000000000000 end= 70000000000000000000 while True: A0 = random.randint(start, end) A1 = ice.scalar_multiplication(A0) B0 = ice.to_cpub(A1.hex()) if B0.startswith("03"): A2 = ice.pubkey_to_address(0,1, A1) print(A2) if target in A2: print("venga rata") data = open("Win.txt","a") data.write(str(A0)+" = "+A2+"\n") data.close()
Same script, but with concurrent.futures. import concurrent.futures import sys import os import time import secp256k1 as ice import random import multiprocessing
os.system("clear");t = time.ctime();sys.stdout.write(f"\033[?25l") sys.stdout.write(f"\033[01;33m[+] {t}\n")
def generate_key(): start = 36893488147419103231 end = 73786976294838206463 A0 = random.randint(start, end) A1 = ice.scalar_multiplication(A0) B0 = ice.to_cpub(A1.hex()) if B0.startswith("03"): A2 = ice.pubkey_to_address(0, 1, A1) message = "[+] {}".format(A2);messages = [];messages.append(message);output = ''.join(messages) + "\r";sys.stdout.write(output);sys.stdout.flush() return A0, A2 else: return None, None
def main(): target = "13zb1hQbWVsc2S7ZTZnP2G4undNNpdh5so" num_cores = multiprocessing.cpu_count() with concurrent.futures.ProcessPoolExecutor(max_workers=num_cores) as executor: while True: futures = [executor.submit(generate_key) for _ in range(num_cores)] for future in concurrent.futures.as_completed(futures): A0, A2 = future.result() if A2 and target in A2: print("venga rata") with open("Win.txt", "a") as data: data.write(f"{A0} = {A2}\n") break
if __name__ == "__main__": main() You can imagine how this works on a 128 Core machine I use Python for testing or when speed is not required, C is better when it comes to speed, I am currently working on a method that allows you to find a key in bit30 in less than 10 seconds, really this part is not the curious one, the curious thing My script has a speed of 2048keys/s, how does it manage to find a key in that range in such a short time with that speed? There is a mathematical trick involved in it, I'm starting to write it in C, to focus on the puzzle 130, once I finish it, if this does not pose a security risk for bitcoin I will make it free. those scripts (both) don't work as expected on my side. I tested with puzzle 30, even with 15 which should be cracked in fractions of seconds. Puzzle 15address = 1QCbW9HWnwQWiQqVo5exhAnmfqKRrCRsvW start = 16384 end = 32768 Puzzle 30address = 1LHtnpd8nU5VHEMkG2TMYYNUjjLc992bps start = 536870912 end = 1073741824 no hit at all You have to change if B0.startswith("03"): to if B0.startswith("02"): for Puzzle 15 It might get better
|
|
|
I think you're missing the point, obviously there are tools that analyze millions of keys per second and will almost instantly find the key...
but my script is not based on speed, 2048 keys/s is nothing, but nevertheless it successfully finds the keys in less than 10 seconds.
That's why I say there is mathematics behind this, I think you don't understand the magnitude of this.
If with 2048keys/s I find bit 30, what do you think will happen when I analyze 10mkeys/s, 100mkeys/s.
I hope this time I explained it well.
You explained well. The point is that I still think that Random Seed is the solution to solve any Puzzle in a few seconds.
|
|
|
I am currently working on a method that allows you to find a key in bit30 in less than 10 seconds
Just 10 seconds? Here's a script that does it in 2 seconds. In Python. import time, random, sys, os, secp256k1 as ice puzzle = 30 target = "1LHtnpd8nU5VHEMkG2TMYYNUjjLc992bps" lower_range_limit = 2 ** (puzzle - 1);upper_range_limit = (2 ** puzzle) - 1 if os.name=='nt':os.system('cls') else:os.system('clear') t = time.ctime();sys.stdout.write(f"\033[?25l");sys.stdout.write(f"\033[01;33m[+] STARTED: {t}\n") sys.stdout.write(f"[+] Puzzle: {puzzle}\n") sys.stdout.write(f"[+] Lower range limit: {lower_range_limit}\n") sys.stdout.write(f"[+] Upper range limit: {upper_range_limit}\n") while True: constant_prefix = b'yx\xcb\x08\xb70' prefix_length = len(constant_prefix);length = 8 ending_length = length - prefix_length;ending_bytes = os.urandom(ending_length) random_bytes = constant_prefix + ending_bytes random.seed(random_bytes) dec = random.randint(lower_range_limit, upper_range_limit) caddr = ice.privatekey_to_address(0, True, dec) message = "\r[+] {}".format(dec);messages = [] messages.append(message);output = "\033[01;33m" + ''.join(messages) + "\r" sys.stdout.write(output);sys.stdout.flush() if caddr == target: HEX = "%064x" % dec;wifc = ice.btc_pvk_to_wif(HEX);t = time.ctime() print(f'[+] SOLVED: {t}');print(f'[+] Bitcoin address Compressed: {caddr}') print(f'[+] Private key (wif) Compressed: {wifc}');print(f'[+] Random Seed: {random_bytes}') break - STARTED: Sat Nov 25 05:07:51 2023
- Puzzle: 30
- Lower range limit: 536870912
- Upper range limit: 1073741823
- SOLVED: Sat Nov 25 05:07:52 2023
- Bitcoin address Compressed: 1LHtnpd8nU5VHEMkG2TMYYNUjjLc992bps
- Private key (wif) Compressed: KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M8diLSC5MyERoW
- Random Seed: b'yx\xcb\x08\xb70l\xf1'
|
|
|
...
it would be awesome if there's a CUDA version for it. I can give you this same script that works in C++ but you have to do the GPU part yourself.CUDA programming can be complex, and proper error handling and synchronization are crucial. Also, not all parts of your program may benefit from GPU acceleration, so it's essential to profile and optimize as needed. puzzle66.cpp #include <iostream> #include <vector> #include <iomanip> #include <openssl/bn.h> #include <openssl/ec.h> #include <openssl/obj_mac.h> #include <openssl/evp.h> #include <openssl/rand.h> #include <openssl/sha.h> #include <openssl/ripemd.h> #include <ctime> #include <sstream> #include <fstream>
// Function to convert a byte vector to a hexadecimal string std::string bytesToHex(const std::vector<unsigned char>& bytes) { std::stringstream ss; for (unsigned char byte : bytes) { ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(byte); } return ss.str(); }
// Function to calculate the RIPEMD160 hash of a byte vector std::vector<unsigned char> calculateRIPEMD160(const std::vector<unsigned char>& data) { std::vector<unsigned char> hash(RIPEMD160_DIGEST_LENGTH); RIPEMD160(data.data(), data.size(), hash.data()); return hash; }
int main() { // Initialize the OpenSSL library if (OpenSSL_add_all_algorithms() != 1) { std::cerr << "OpenSSL initialization failed." << std::endl; return 1; }
// Set the target Hash160 value (replace with your target hash) std::string target_hash160_hex = "20d45a6a762535700ce9e0b216e31994335db8a5";
int puzzle = 66; // The puzzle number (Bits)
// Clear the console std::system("clear"); std::cout << "\r\033[01;33m[+] Bytea HASH160 Search by NoMachine" << "\n"; time_t currentTime = std::time(nullptr); std::cout << "\r\033[01;33m[+] " << std::ctime(¤tTime) << "\r"; std::cout << "\r\033[01;33m[+] Puzzle: " << puzzle << "\033[0m" << std::endl; std::cout.flush();
// Calculate the maximum bytes value based on the puzzle BIGNUM* limit_int = BN_new(); BN_set_word(limit_int, 1); BN_lshift(limit_int, limit_int, puzzle); BN_sub_word(limit_int, 1); int max_bytes = (BN_num_bits(limit_int) + 7) / 8;
// Create an EC_KEY object EC_KEY* ec_key = EC_KEY_new_by_curve_name(NID_secp256k1);
// Calculate the SHA-256 hash of the public key unsigned char sha256_result[SHA256_DIGEST_LENGTH];
// Calculate the RIPEMD160 hash of the SHA-256 hash std::vector<unsigned char> ripemd160_result(RIPEMD160_DIGEST_LENGTH);
while (true) { // Create a 32-byte private key with 32 zeros followed by random bytes std::vector<unsigned char> private_key_bytes(32, 0);
// Generate random bytes for the remaining part of the private key std::vector<unsigned char> random_bytes(max_bytes); if (RAND_bytes(random_bytes.data(), random_bytes.size()) != 1) { std::cerr << "Error generating random bytes." << std::endl; BN_free(limit_int); EC_KEY_free(ec_key); return 1; }
// Append the random bytes to the private key std::copy(random_bytes.begin(), random_bytes.end(), private_key_bytes.begin() + 32 - max_bytes);
// Create a BIGNUM from the private key bytes BIGNUM* bn_private_key = BN_bin2bn(private_key_bytes.data(), private_key_bytes.size(), NULL);
// Set the private key in the EC_KEY object EC_KEY_set_private_key(ec_key, bn_private_key);
// Compute the public key from the private key EC_POINT* public_key_point = EC_POINT_new(EC_KEY_get0_group(ec_key)); EC_POINT_mul(EC_KEY_get0_group(ec_key), public_key_point, bn_private_key, NULL, NULL, NULL);
// Convert the public key point to binary representation (compressed) size_t public_key_length = EC_POINT_point2oct(EC_KEY_get0_group(ec_key), public_key_point, POINT_CONVERSION_COMPRESSED, NULL, 0, NULL); std::vector<unsigned char> public_key_bytes(public_key_length); EC_POINT_point2oct(EC_KEY_get0_group(ec_key), public_key_point, POINT_CONVERSION_COMPRESSED, public_key_bytes.data(), public_key_length, NULL);
// Check if the public key starts with "02" (compressed format) if (public_key_bytes[0] == 0x02) { SHA256(public_key_bytes.data(), public_key_bytes.size(), sha256_result); ripemd160_result = calculateRIPEMD160(std::vector<unsigned char>(sha256_result, sha256_result + SHA256_DIGEST_LENGTH));
// Convert the calculated RIPEMD160 hash to a hexadecimal string std::string calculated_hash160_hex = bytesToHex(ripemd160_result);
// Display the generated public key hash (Hash160) and private key std::string message = "\r\033[01;33m[+] Public Key Hash (Hash 160): " + calculated_hash160_hex; std::cout << message << "\e[?25l"; std::cout.flush();
// Check if the generated public key hash matches the target if (calculated_hash160_hex == target_hash160_hex) { // Get the current time std::time_t currentTime; std::time(¤tTime); std::tm tmStruct = *std::localtime(¤tTime);
// Format the current time into a human-readable string std::stringstream timeStringStream; timeStringStream << std::put_time(&tmStruct, "%Y-%m-%d %H:%M:%S"); std::string formattedTime = timeStringStream.str();
std::cout << "\n\033[32m[+] PUZZLE SOLVED: " << formattedTime << "\033[0m" << std::endl; std::cout << "\r\033[32m[+] Target Public Key Hash (Hash160) found! Private Key: " << bytesToHex(private_key_bytes) << std::endl;
// Append the private key information to a file if it matches std::ofstream file("KEYFOUNDKEYFOUND.txt", std::ios::app); if (file.is_open()) { file << "\nPUZZLE SOLVED " << formattedTime; file << "\nPrivate Key (hex): " << bytesToHex(private_key_bytes); file << "\n--------------------------------------------------------------------------------------------------------------------------------------------"; file.close(); }
break; } } }
// Free the EC_KEY and BIGNUM objects BN_free(limit_int); EC_KEY_free(ec_key);
return 0; } Script check if the public key starts with "02" (compressed format) and you can change to "03". Makefile # Makefile
# Source files SRC = puzzle66.cpp
# Compiler and flags CXX = g++ CXXFLAGS = -m64 -march=native -mtune=native -mfpmath=sse -Wall -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -msse4a -mavx -pthread -O3 -I.
# OpenSSL libraries LIBS = -lssl -lcrypto
# Output executable TARGET = puzzle66
# Default target all: $(TARGET)
# Rule for compiling the source code $(TARGET): $(SRC) $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
# Clean target to remove generated files clean: rm -f $(TARGET)
.PHONY: all clean I am running this on an AMD Ryzen 9 7950X. It has compiler flags for AMD which accelerate mathematical crypto functions. A similar file must be created for CUDA. Good luck.... p.s. Tested on Puzzle 15 - works fine...... - Bytea HASH160 Search by NoMachine
- Thu Nov 23 15:11:22 2023
- Puzzle: 15
- Public Key Hash (Hash 160): fe7c45126731f7384640b0b0045fd40bac72e2a2
- PUZZLE SOLVED: 2023-11-23 15:11:24
- Target Public Key Hash (Hash160) found! Private Key: 00000000000000000000000000000000000000000000000000000000000068f3
|
|
|
import secp256k1 as ice import random
print("scaning pub 03...")
target = "13zb1hQbWVsc2S7ZTZnP2G4undNNpdh5so"
start= 50000000000000000000 end= 70000000000000000000 while True: A0 = random.randint(start, end) A1 = ice.scalar_multiplication(A0) B0 = ice.to_cpub(A1.hex()) if B0.startswith("03"): A2 = ice.pubkey_to_address(0,1, A1) print(A2) if target in A2: print("venga rata") data = open("Win.txt","a") data.write(str(A0)+" = "+A2+"\n") data.close()
Same script, but with concurrent.futures. import concurrent.futures import sys import os import time import secp256k1 as ice import random import multiprocessing
os.system("clear");t = time.ctime();sys.stdout.write(f"\033[?25l") sys.stdout.write(f"\033[01;33m[+] {t}\n")
def generate_key(): start = 36893488147419103231 end = 73786976294838206463 A0 = random.randint(start, end) A1 = ice.scalar_multiplication(A0) B0 = ice.to_cpub(A1.hex()) if B0.startswith("03"): A2 = ice.pubkey_to_address(0, 1, A1) message = "[+] {}".format(A2);messages = [];messages.append(message);output = ''.join(messages) + "\r";sys.stdout.write(output);sys.stdout.flush() return A0, A2 else: return None, None
def main(): target = "13zb1hQbWVsc2S7ZTZnP2G4undNNpdh5so" num_cores = multiprocessing.cpu_count() with concurrent.futures.ProcessPoolExecutor(max_workers=num_cores) as executor: while True: futures = [executor.submit(generate_key) for _ in range(num_cores)] for future in concurrent.futures.as_completed(futures): A0, A2 = future.result() if A2 and target in A2: print("venga rata") with open("Win.txt", "a") as data: data.write(f"{A0} = {A2}\n") break
if __name__ == "__main__": main() You can imagine how this works on a 128 Core machine
|
|
|
I'm currently running keyhunt in bsgs random mode on a 10gb bloomfilter file on puzzle 130. But i realize its probably pointless...
That will probably be solved by the same group/individual that solved 125. And after that, we only have Puzzles with hash 160 left. A rookie trying to spit knowledge on here 😂 Or at least one who doesn’t know how Kangaroo works and the expected group ops needed to solve the challenges with pubkeys, compared to the H160s left. OK. Genius. I left this thread. If you wanted it, you succeeded. Enjoy your intelligence alone.
|
|
|
What about 135, 140 etc?
Unprofitable to deal with. Even if I had a farm with 5000 GPUs I wouldn't bother with it. Whoever came up with this Puzzle knows exactly what he's doing.
|
|
|
I'm currently running keyhunt in bsgs random mode on a 10gb bloomfilter file on puzzle 130. But i realize its probably pointless...
That will probably be solved by the same group/individual that solved 125. And after that, we only have Puzzles with hash 160 left.
|
|
|
Still .. what this script is really trying to do ? It just generates random 66bit HEX numbers in hope to hit 66 puzzle ? Or is there something else here ?
Not random. It goes Sequentially. "To kill boredom" script. Like all the other useless scripts here. But ... with that speed ... it's a complete joke. I can do the same with existing tools on nvidia card much faster. So what's the point of making such scripts ? It's a complete joke even with 5 GPUs. Compared to the required 200 Giga hashes per second. Everything is joke. Any script that looks for hash 160. Even if you have a farm with graphics (and I tried there Puzzle 66 too) . The only question is who is the biggest clown. Or whose jokes seems the smartest in the eyes of the public.
|
|
|
|