-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbinary_database.py
79 lines (47 loc) · 1.79 KB
/
binary_database.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#@mcdouglasx
import secp256k1 as ice
from bitstring import BitArray
import bitcoin
print("Making Binary Data-Base")
target_public_key = "030d282cf2ff536d2c42f105d0b8588821a915dc3f9a05bd98bb23af67a2e92a5b"
target = ice.pub2upub(target_public_key)
num = 10000 # number of keys.
sustract= 1 #amount to subtract each time, If you modify this, use the same amount to scan.
Low_m= 10
lm= num // Low_m
print(lm)
sustract_pub= ice.scalar_multiplication(sustract)
res= ice.point_loop_subtraction(lm, target, sustract_pub)
binary = ''
for t in range (lm):
h= (res[t*65:t*65+65]).hex()
hc= int(h[2:], 16)
if str(hc).endswith(('0','2','4','6','8')):
A="0"
binary+= ''.join(str(A))
if str(hc).endswith(('1','3','5','7','9')):
A="1"
binary+= ''.join(str(A))
my_str = bytes(BitArray(bin=binary))
binary_file = open('data-base.bin', 'ab')
binary_file.write(my_str)
binary_file.close()
for i in range (1,Low_m):
lm_upub= sustract_pub= ice.scalar_multiplication((lm*i)*sustract)
A1= ice.point_subtraction(target, lm_upub)
sustract_pub= ice.scalar_multiplication(sustract)
res= ice.point_loop_subtraction(lm, A1, sustract_pub)
binary = ''
for t in range (lm):
h= (res[t*65:t*65+65]).hex()
hc= int(h[2:], 16)
if str(hc).endswith(('0','2','4','6','8')):
A="0"
binary+= ''.join(str(A))
if str(hc).endswith(('1','3','5','7','9')):
A="1"
binary+= ''.join(str(A))
my_str = bytes(BitArray(bin=binary))
binary_file = open('data-base.bin', 'ab')
binary_file.write(my_str)
binary_file.close()