Only 2 ?
import os
import time
import secrets
import random
import binascii
import base58
import hashlib
import ecdsa
import multiprocessing
from multiprocessing import cpu_count
def generate_private_key_WIF(start, miss):
return start + "".join(
secrets.choice(
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
)
for _ in range(miss)
)
def check_private_key(start, miss, target_binary):
while not STOP_EVENT.is_set():
private_key_WIF_str = generate_private_key_WIF(start, miss)
if start[0] == '5':
private_key_WIF = private_key_WIF_str
first_encode = base58.b58decode(private_key_WIF)
private_key_full = binascii.hexlify(first_encode)
private_key = private_key_full[2:-8]
if start[0] in ['L', 'K']:
private_key_WIF = private_key_WIF_str
first_encode = base58.b58decode(private_key_WIF)
private_key_full = binascii.hexlify(first_encode)
private_key = private_key_full[2:-10]
private_key_hex = private_key.decode("utf-8")
dec = int(private_key_hex[0:64], 16)
dec_bytes = dec.to_bytes((dec.bit_length() + 7) // 8, 'big')
private_key_bytes = b'\x00' * 32
private_key_bytes = private_key_bytes[:-len(dec_bytes)] + dec_bytes
signing_key = ecdsa.SigningKey.from_string(private_key_bytes, curve=ecdsa.SECP256k1)
compressed_public_key = signing_key.get_verifying_key().to_string("compressed")
sha256_hash = hashlib.sha256(compressed_public_key).digest()
ripemd160_hash = hashlib.new('ripemd160', sha256_hash).digest()
extended_private_key = b'\x80' + private_key_bytes + b'\x01'
checksum = hashlib.sha256(hashlib.sha256(extended_private_key).digest()).digest()[:4]
private_key_with_checksum = extended_private_key + checksum
wif_compressed = base58.b58encode(private_key_with_checksum).decode()
message = "\r[+] {} ".format(private_key_WIF_str)
messages = []
messages.append(message)
output = "\033[01;33m" + ''.join(messages) + "\r"
sys.stdout.write(output)
sys.stdout.flush()
if ripemd160_hash == target_binary:
t = time.ctime()
sys.stdout.write(f"\n\033[01;33m[+] BINGO!!! {t}\n")
with open('winner.txt', 'a') as file:
t = time.ctime()
file.write('\n\nMatch Found: ' + t)
file.write('\nPrivatekey (dec): ' + str(dec))
file.write('\nPrivatekey (hex): ' + hex(dec)[2:])
file.write('\nPrivatekey (wif): ' + wif_compressed)
STOP_EVENT.set()
return
if __name__ == '__main__':
start = "KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qZM21gaY8W"
miss = 52 - (len(start))
# Define the target as bytes
target_hex = "52e763a7ddc1aa4fa811578c491c1bc7fd570137"
target_binary = bytes.fromhex(target_hex)
os.system("clear")
t = time.ctime()
sys.stdout.write(f"\033[01;33m[+] {t}\n")
sys.stdout.write(f"\033[01;33m[+] Ending characters missing: {miss}\n")
sys.stdout.write(f"\033[01;33m[+] Public Key Hash (Hash 160): {target_hex}\n")
sys.stdout.flush()
# Create a global STOP_EVENT
STOP_EVENT = multiprocessing.Event()
# Create a pool of worker processes
num_processes = multiprocessing.cpu_count()
pool = multiprocessing.Pool(processes=num_processes)
# Start the worker processes with different starting points
for i in range(num_processes):
pool.apply_async(check_private_key, args=(start, miss, target_binary))
# Close the pool and wait for all processes to complete
pool.close()
pool.join()
- Mon Oct 23 00:26:17 2023
- Ending characters missing: 10
- Public Key Hash (Hash 160): 52e763a7ddc1aa4fa811578c491c1bc7fd570137
- KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qZM21gaY8WN2CdwnTG57
- BINGO!!! Mon Oct 23 00:26:20 2023