iceland2k14/bsgs

does not get the right PVK

kuiwang opened this issue · 3 comments

when I execute the command:
python bsgs_hybrid_dll_gmp.py -pfile testpk.txt -b mybpfile.bin -bl mybloom.bin -keyspace 1:0x1000

the result is:
A False collision ignored
A False collision ignored
A False collision ignored
A False collision ignored
============== KEYFOUND ==============
BSGS FOUND PrivateKey 0x3

============== KEYFOUND ==============
BSGS FOUND PrivateKey 0x3

[+] Range Finished

testpk.txt content in below:

02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
04c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee51ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a
02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9
04f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672

private_key = 0x2 :
compressed publickey:
02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
uncompressed publickey:
04c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee51ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a

private_key = 0x3 :
compressed publickey:
02f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9
uncompressed publickey:
04f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672

bsgs_hybrid_dll_gmp.py does NOT find the privatekey when the publickey is generated by 0x2.
but it finds the correct result when the publickey is generated by 0x3.

@iceland2k14 something is wrong? could you help me,please

Yes You Found a Nice Bug. The reason is 2 time subtraction of 1.

S = bytes(bytearray(point_subtraction(pubkey_point, k1G)))

S = bytes(bytearray(point_subtraction(pubkey_point, z1G)))

In fact i will correct it in a different way. During script initialization, first try with directly matching with the bpfile elements if the search starts with 1.

Thanks for your help @iceland2k14

Fixed in latest commit