iceland2k14/secp256k1

parse data

Closed this issue · 16 comments

hi .how can i parse result of this function
ice.point_sequential_increment(3500000, P)

thanks . i have a problem i hope you help me.
I want to search many publickeys in provided data from this function , i use this code :

paragraph=(ice.point_sequential_increment(1000000, P).hex())
x = 130
counter2=0;
c2 = [0] * 100000
for i in range(0, len(paragraph), x):
c2[counter2]= bytes.fromhex(paragraph[i+2: i + x]).hex()
if c2[counter2] in address:
print(counter2)
counter2=counter2+1;

but search decrease my speed .is there any solution .

num=10                                       #  0         1        2                   3
seq=btc.point_sequential_increment(num,P,);  # 'P+G', 'P+G', 'P+G''P+2G', 'P+G''P+2G''P+3G'...
points=[ seq[i*65:(i+1)*65] for i in range(0,len(seq)//65)]
num=10                                       #  0         1        2                   3
seq=btc.point_sequential_increment(num,P,);  # 'P+G', 'P+G', 'P+G''P+2G', 'P+G''P+2G''P+3G'...
points=[ seq[i*65:(i+1)*65] for i in range(0,len(seq)//65)]

I think u dont understand I want to search quickly between the public keys created

Now I understand. Test it. If it turns out that the search is much faster than the calculations, then how you search is irrelevant.

with my code: my search is slower than calculations. I'm looking for a solution to speed up the search. i have a set of publickeys ( address in mycode)

@ramin1234 .

  1. Make sure address is either set or dict. don't use list or tuple they are slow for lookup.
  2. to move from 1 pubkey to another from the array, you can use the code as suggested by @longnetwork.
  3. Another alternative is to use numpy if you like to. Just a simple way below...You can use any other way you like...
data = np.frombuffer(ice.point_sequential_increment(1000000, P), np.uint8)
data.shape = (len(data)//65, 65)
for line in data:
   if line.tobytes().hex() in address: print('Success')

thanks alot . i use your code here:
f = open("publickeys.txt", "r")
address=set(f.read().split(","));
print(address)
data = np.frombuffer(ice.point_sequential_increment(counter, P), np.uint8)
data.shape = (len(data)//65, 65)
for line in data:
if line.tobytes().hex() in address: print('Success')

but i have two question :
1-Is it better to separate my publickeys.txt with a line or with "," .
2- is it best solution for search in set .is there not better search performance?

thanks

@iceland2k14
I have all the ethereum public keys. We should not waste time on the address, we just find the public key. Please help me, I will share the public keys

Line separated is better. Each Pubkey or address in separate line. And read..

eth_list = [line.split()[0] for line in open("eth_input_file.txt",'r')]
eth_list = set(eth_list)

@iceland2k14
thanks a lot . it was very useful.I'm sorry I bothered you so much.
i had antoher question number 2.
is it best solution for search in set .is there not better search performance?
for example i have many public key , i use this code:

def finding(x):
data = np.frombuffer(ice.point_sequential_increment(counter, P), np.uint8)
data.shape = (len(data)//65, 65)
counter2=0
for line in data:
if line.tobytes().hex() in address:
print("success");

priv=77193640190956797439718760382716456180983024112193197385136182803714156454442
counter=3500000
eth_list = [line.split()[0] for line in open("key3.txt",'r')]
address = set(eth_list)

for i in range(1,10000):
P = ice.scalar_multiplication(priv)
if (finding(P )!=None):
break;
priv=priv+counter

Is there another solution?

Currently the best solution for lookup in python is Fastest_lookup
If the items in the array are very large you must use bloom filters for better performance. See example in my bloom Filter lookup

excuse me can you explain more
1- python bsgs_hybrid_dll_secp256k1.py -pfile line.txt -b bPfile.bin -bl bloomfile.bin -n 5000000 -keyspace FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
2- python bsgs_hybrid_dll_secp256k1.py -pfile line.txt -b bPfile.bin -bl bloomfile.bin -n 5000000 -keyspace 1:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

both of them has same speed . what is different between them,
or
python bsgs_hybrid_dll_secp256k1.py -pfile line.txt -b bPfile.bin -bl bloomfile.bin -n 5000000 -keyspace 1:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
python bsgs_hybrid_dll_secp256k1.py -pfile line.txt -b bPfile.bin -bl bloomfile.bin -n 500 -keyspace 1:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

both of them has same speed . what is different between them,(-n changed);

That script link was to explain the fast lookup question to show how to use bloom filters.
For actual script usage and understanding, please read the Readme and bsgs Algo and Bloom filters.