GithubHelp home page GithubHelp logo

LSB 2bit bias about lattice-attack HOT 4 CLOSED

bitlogik avatar bitlogik commented on July 17, 2024
LSB 2bit bias

from lattice-attack.

Comments (4)

bitlogik avatar bitlogik commented on July 17, 2024

Before digging down to help you on a third-party topic, here's some info about LSB with LatticeAttack :
Each "kp" is an integer in the range is [ 0 : 2**KnownBits - 1 ]
Example if the LSB known for "k" are 0b00101 for a given signature :
-> { "hash": xyz, "r": xxx, "s": xxx, "kp": 5 }
So basically for LSB, there is no shift at all, and you provide the known bits for each signature as an integer. You can even write the 0bxxx in the code so they're binary provided.
To get the LSB from the full nonce, the best option is to use a simple mask as the maximum value, for example with 5 bits, your mask the full nonce with 0b11111, which is 31 : nonce & 31.
Also you can get the LSB from the full nonce with modulo 2**known_bits, in the example of 5 bits : nonce % 32.

For the topic "down to 2 bits", note that we never found a private key using our LatticeAttack software below 4 know bits, hence the restriction put in place that prevent the user to run it with lower than 4 bits. But we never performed long running time. Using higher RECOVERY_SEQUENCE "effort" block size, combined with a loop "-l" can be a way to recover key with 3 or even 2 bits. That would just require long running times (several hours), and no guarantee of result.

from lattice-attack.

eychei avatar eychei commented on July 17, 2024

Thanks for the clarification.
I will adapt the code and see what happens.
If I understand this correctly I just have to mask the input signatures (not the msgs) and the resulting vector of the LLL Matrix should be the nonce?
I am using the LLL Matrix suggested by Heninger et al. . According to her comment on github, I would need to shift the signatures and at the end shift back the calculated nonce. This is not the case in your solution right?

-e

from lattice-attack.

eychei avatar eychei commented on July 17, 2024

Looking at your code and implementing the LLL Matrix in my own code I am now able to calculate with LSB bias. Thank you for the help.
Why is it that the matrix is returning the priv_key and not the nonce in row[-2]?

-e

from lattice-attack.

bitlogik avatar bitlogik commented on July 17, 2024

I just have to mask the input signatures (not the msgs) and the resulting vector of the LLL Matrix should be the nonce?

No, the HNP for ECDSA, you know partial information about the nonces, and you know all signatures and their message (plus the public key). The masks only apply to the nonce, but usually, as we know partial data, there's no need to mask anything.
Read the scientific material we provide in the Readme bibliography. They provide lots of details on the HNP method.

For LatticeAttack, one has to provide for each signature the "kp" integer, the known part of kp, in the format explained. In practice, this is often 0, when the read detected bits are all zeros.

Why is it that the matrix is returning the priv_key and not the nonce in row[-2] ?

See Minerva paper ยง4.4, LatticeAttack is using SVP method with the "recentering" optimisation, and random subset.

Some HNP lattice are built with one variable less. That is sometimes referred as the "Eliminating One Variable" optimization, a way to reduce the lattice dimension, with the elimination of a variable from the system : the private key is discarded, for "equation relatives". That gives a little boost to the lattice reduction solving, as the dimension is decreased by 1. This slightly decrease the matrix reduction time, at the expense of very complex and iterative computations to build the matrix, and then to recover the private key. So LatticeAttack is not using this optimization, we estimate it brings more complexity for a very small speedup. Even the matrix speed up can be lost by the "outer" computations added.
Still, this optimization can be effective when doing EHNP, because this involves very large matrix, and it gains one dimension for every hole/parts. LatticeAttack is not doing EHNP for now. You can read further details about EHNP and optimizations in this publication ยง3.3. Side Journey to Titan is also using this "one less variable" optimization, as they have to use EHNP.

from lattice-attack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.