Modified Lattice Attack Script

6 replies 351 views
benseedFull Member
Posts: 60 · Reputation: 461
#1Sep 14, 2017, 10:11 AM
I tweaked the gen_data.py script found at this GitHub repo: https://github.com/bitlogik/lattice-attack. Now, whenever you generate sets of R,S,Z(HASH) Signatures, you can see the K_Nonce value used. Just a heads up, it doesn't show up in the json file like the other data; you'll see it directly in the Terminal. The full modified code is below. Make sure to enter your own public keys' XY coordinates in gen_data.py. I also updated ecdsa_lib.py to include a print function for the K_Nonce. With R,S,Z(HASH) and now K nonce out in the open, you can head over here and plug in your data: https://rawcdn.githack.com/nlitsme/bitcoinexplainer/aa50e86e8c72c04a7986f5f7c43bc2f98df94107/ecdsacrack.html to find the Private key. With this info, you’re pretty close to getting the private key. Best of luck!
3 Reply Quote Share
nickaltMember
Posts: 32 · Reputation: 129
#2Sep 14, 2017, 04:05 PM
Hi there,  This is interesting, but is not quite working for me. After I generate the json file, once I run the lattice.py I get this error: Loading data from file data7.json Public key data invalid, not on the given SECP256K1 curve. I think it has to do with the format that the xY coordinates I am putting in is not correct. My question it, where and how you get this XY ( or RS) coordinates from, so that they are in the right format to go in gendata.py? Thanks for your input
4 Reply Quote Share
omega_bearFull Member
Posts: 116 · Reputation: 780
#3Sep 14, 2017, 07:46 PM
KRASH Can you add calculation of privkey to scrypt? pvk = (inv(r) *  ( (k*s)-z )    ) % N
4 Reply Quote Share
nickaltMember
Posts: 32 · Reputation: 129
#4Sep 17, 2017, 02:55 AM
I have added those definitions but I get an error. Is that the right part of the code on the lattice_attack.py for them to go in? THANKS. mahuro@machine1:~/lattice-attack$ python3 lattice_attack.py -f data7.json   File "/home/mahuro/lattice-attack/lattice_attack.py", line 41     r * pvk = (  (k*s)-z )  % N     ^^^^^^^ SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
1 Reply Quote Share
nickaltMember
Posts: 32 · Reputation: 129
#5Sep 17, 2017, 04:42 AM
Not sure where in the code should it go the definitions you mentioned. I get another error, but I think I am closer now. I think I simply need to change of private_value to integer, But I am not sure how. There is a comment in the lattice_attack.py that says how to convert between integer and hex, but it doesnt say where those given equations should go: # To convert to integer : # if got bytes use : int.from_bytes(bytesvar, bytesorder="big") # if got hex use : int(hexintvar, 16) # Has anyone got this to actually work? just curious...
3 Reply Quote Share
omega_bearFull Member
Posts: 116 · Reputation: 780
#6Sep 17, 2017, 08:53 AM
krossfire know kode, he can do it
0 Reply Quote Share
benseedFull Member
Posts: 60 · Reputation: 461
#7Sep 17, 2017, 10:05 AM
theres no point running this. as the rsz created will not point to the correct private key or public key. ran it a long time ago.
2 Reply Quote Share

Related topics