# finding sha256 preimage or secp256k1 private key, which is harder?

Is finding a public key that matches hash of pre-commited public key (second layer security) more computationally hard than finding private key to a known public key (attacking secp256k1)?

## 1 Answer

To the best of our knowledge, finding a SHA-256 preimage is much harder than finding a secp256k1 private key; however both are current infeasible.

For SHA-256, the best known attack is to simply try lots of images until you stumble across one which hashes to the value you're looking for; that takes an expected $$2^{256}$$ hashes.

For Secp256k1, there are several known generic attacks (Big-Step-Little-Step, Pollard Rho) which reduces the expected complexity of finding the private key to about $$2^{128}$$ point additions.

Even though a point addition is considerably more expensive than computing a hash, it's not $$2^{128}$$ times as expensive, and so attacking secp256k1 is the easier option.

On the other hand, $$2^{128}$$ point additions is far more than is possible with current hardware (even if you had truly massive amounts of computational resources), and so it is safe.

On the third (gripping) hand, if the attacker can wait for a practical quantum computer to be built, that could recover the secp256k1 private key in a reasonable amount of time; no one knows when such a quantum computer will exist; it's likely not to be for the next decade or so. However, if you need to be secure past then, you might want to rethink what you're doing.