iceland2k14 / bsgs

Find PrivateKey of corresponding Pubkey(s) using BSGS algo
MIT License
111 stars 61 forks source link

The new script does not count correctly #10

Closed Mezantrop74 closed 3 years ago

Mezantrop74 commented 3 years ago

Hello. The latest version of the script does the wrong calculation. Сохраненное изображение 2021-3-17_14-27-6 260

Mezantrop74 commented 3 years ago

In this case, the public key is calculated correctly. photo_2021-03-17_14-57-30

vanrzuf commented 3 years ago

The same error is in previous version. Script is searching for matching X of pubkey. There are 2 pubkeys with the same X. For example:

priv
0000000000000000000000000000000000000000000000000000000000000002
fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413f

pub
02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
03c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5

2priv is max_priv_key - 2

As i can see, for some reason, if we search for 2priv in range of 1priv, script gives us 1priv +2 instead max_priv_key - 1priv

iceland2k14 commented 3 years ago

Yes it is known and expected. As we match xPoint of a Pubkey then both the Privatekey is known instantly. (PVK, Order-PVK) Maybe i will add a strict check to display only the required PVK, next time. Thanks for pointing this.

vanrzuf commented 3 years ago

Well now i'm confused 02deaef545ae247123354d3db69310167704a46236775e725c690c00b1d6c8f34c 03deaef545ae247123354d3db69310167704a46236775e725c690c00b1d6c8f34c WindowsTerminal_n3nVoy03QU

iceland2k14 commented 3 years ago

Order = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

Pubkey = 02deaef545ae247123354d3db69310167704a46236775e725c690c00b1d6c8f34c, PrivateKey = 0xc7d5b70 Pubkey = 03deaef545ae247123354d3db69310167704a46236775e725c690c00b1d6c8f34c, PrivateKey = Order - 0xc7d5b70 = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cc3b8e5d1

Case (1) : python bsgs_v5_gmp.py -p 02deaef545ae247123354d3db69310167704a46236775e725c690c00b1d6c8f34c -b FULLbpfile.bin -bl Bigbloomfilter.bin -n 20000000000000 -keyspace 1:FFFFFFFFFFFF

Case (2) : python bsgs_v5_gmp.py -p 03deaef545ae247123354d3db69310167704a46236775e725c690c00b1d6c8f34c -b FULLbpfile.bin -bl Bigbloomfilter.bin -n 20000000000000 -keyspace fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cc0000000:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141

iceland2k14 commented 3 years ago

@Mezantrop74 Thank you Very much for this test. I found that Yes it was a Bug related to Boundary Key. Incremental subtraction was able to match both side of boundary and caught the Wrong side key. I have added the strict check and now it will match both (x & y) before final print. Code Updated.