How many keys are you generating in your DB?
Are you using OPs github script versions? Or did you make any changes?
import secp256k1 as ice
def _point_subtraction(pubkey1_bytes, pubkey2_bytes):
return ice.point_subtraction(pubkey1_bytes, pubkey2_bytes)
def point_subtraction(pubkey1_bytes, pubkey2_bytes):
res = _point_subtraction(pubkey1_bytes, pubkey2_bytes)
return bytes(bytearray(res))
target_public_key = "026ecabd2d22fdb737be21975ce9a694e108eb94f3649c586cc7461c8abf5da71a"
target = ice.pub2upub(target_public_key)
num = 2**23
subtract= 2**10
subtract_pub= ice.scalar_multiplication(subtract)
with open('data-base.bin', 'wb') as binary_file:
current_pubkey = target
byte_accumulator = 0
bit_position = 0
for _ in range(num):
current_pubkey = point_subtraction(current_pubkey, subtract_pub)
binary_data = int(current_pubkey.hex(), 16)
bit = 0 if str(binary_data).endswith(('0', '2', '4', '6', '8')) else 1
byte_accumulator = (byte_accumulator << 1) | bit
bit_position += 1
if bit_position == 8:
binary_file.write(byte_accumulator.to_bytes(1, byteorder='big'))
byte_accumulator = 0
bit_position = 0
if bit_position > 0:
byte_accumulator <<= (8 - bit_position)
binary_file.write(byte_accumulator.to_bytes(1, byteorder='big'))
import multiprocessing
import random
import secp256k1 as ice
from bitstring import BitArray
import psutil
import mmap
def kmp_prefix(pattern):
prefix_table = [0] * len(pattern)
j = 0
for i in range(1, len(pattern)):
while j > 0 and pattern[i] != pattern[j]:
j = prefix_table[j - 1]
if pattern[i] == pattern[j]:
j += 1
prefix_table[i] = j
return prefix_table
def kmp_search(text, pattern, prefix_table):
j = 0
for i in range(len(text)):
while j > 0 and text[i] != pattern[j]:
j = prefix_table[j - 1]
if text[i] == pattern[j]:
j += 1
if j == len(pattern):
return i - j + 1
return -1
def main_task(start, end, file_map):
prefix_table = kmp_prefix(file_map)
try:
while True:
pk = random.randint(start, end)
target = ice.scalar_multiplication(pk)
num = 64 # number of times
sustract = 2**10 # amount to subtract each time
sustract_pub = ice.scalar_multiplication(sustract)
res = ice.point_loop_subtraction(num, target, sustract_pub)
binary = ''
for t in range(num):
h = (res[t * 65:t * 65 + 65]).hex()
hc = int(h[2:], 16)
if str(hc).endswith(('0', '2', '4', '6', '8')):
binary += "0"
if str(hc).endswith(('1', '3', '5', '7', '9')):
binary += "1"
my_str = binary
b = bytes(BitArray(bin=my_str))
match_position = kmp_search(file_map, b, prefix_table)
if match_position != -1:
inx = match_position * sustract
Pk = (int(pk) + int(inx)) + int(inx) * 7
print(hex(Pk))
with open("win45.txt", "a") as data_file:
data_file.write("Pk:" + " " + hex(Pk) + "\n")
except KeyboardInterrupt:
print("Пpoцecc был пpepвaн пoльзoвaтeлeм")
return
def worker(start, end, file_map):
main_task(start, end, file_map)
def split_range(start, end, num_splits):
step = (end - start) // num_splits
return [(start + i * step, start + (i + 1) * step) for i in range(num_splits)]
if __name__ == '__main__':
total_start = 2**44
total_end = 2**45
num_physical_cores = psutil.cpu_count(logical=False)
with open("data-base.bin", "r+b") as f:
file_map = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
range_splits = split_range(total_start, total_end, num_physical_cores)
processes = []
try:
for start, end in range_splits:
p = multiprocessing.Process(target=worker, args=(start, end, file_map))
processes.append(p)
p.start()
for p in processes:
p.join()
except KeyboardInterrupt:
print("Ocнoвнoй cкpипт был пpepвaн. Зaвepшeниe вcex пpoцeccoв.")
for p in processes:
p.terminate()
p.join()
print("Bce пpoцeccы ycпeшнo зaвepшeны.")
file_map.close()
The scripts have changed a little, but the general meaning is the same.
Perhaps I made a mistake somewhere?