0
$\begingroup$

I want to find a number, such that the result of its SHA-256 hash is all 0.

I don't know if this number exists.

$\endgroup$
  • $\begingroup$ I'll edit your question a bit to make it more reader friendly. $\endgroup$ – DannyNiu Jun 29 at 5:26
  • 1
    $\begingroup$ What you're looking for is a preimage attack, there are no known ones against SHA-256. Here are related questions. $\endgroup$ – Marc Jun 29 at 5:28
1
$\begingroup$

For any output $z\in \{0,1\}^{256}$ it is very unlikely that there is no input mapping to it, since the input space is astronomically larger than the output space, and SHA256 has been carefully designed as a pseudorandom function. So, most likely yes such an input exists.

The number of trials you need to find such an input (no shortcut better than trying random inputs is known) is approximately $2^{256},$ this is the first preimage problem in hash function theory.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Actually the relevant "input size" of SHA-256 is quite limited. The SHA256 compression function should consume 512bit blocks and keep 256bit states so you roughly get 768bits of input for the (relevant) last iteration $\endgroup$ – Christoph Egger Jun 29 at 16:12
  • $\begingroup$ @CristophEgger, could you give a precise context or reference for this claim? Thanks. $\endgroup$ – kodlu Jun 29 at 22:07
  • $\begingroup$ See en.wikipedia.org/wiki/Merkle%E2%80%93Damg%C3%A5rd_construction it does not matter how long the "message" is that you feed to SHA only the input to the last round or finalize step. Now each of the "arrows" carries forward a limited amount of information (seems 256 bit for SHA2-256 de.wikipedia.org/wiki/SHA-2) and either there is such a value for the last step or there isn't independent of how many blocks have already been hashed $\endgroup$ – Christoph Egger Jun 30 at 15:32
  • $\begingroup$ Framed differently, there is a strictly limited amount of "state bits" that get updated by your hash algorithm when they consume one more block of message. If you want to retrieve a particular hash value the question of whether such a preimage exist only depends (essentially) on the state space. If your message space is significantly larger it will only result in colissions of your state vector in some previous round and all message prefixes that lead to the same state are "the same". How large that state is depends on your concrete hash function then. $\endgroup$ – Christoph Egger Jun 30 at 15:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.