0

My understanding is the when you are mining bitcoin you are looking for a string, or maybe a binary number (a) such that if you 'add' a to the block (b) you get a number (c) whose hash begins with a bunch of zeros.

My question is: Say I know that the message b 'added' with the number a gets mapped to my desired output. Why is it not possible for me, given a different block (b2) to find a corresponding number (a2), such that the hash of the result will map to the same number c?

What is the operation that combines the block b with the number a that makes this impossible? Is it simple appending?

2
  • 1
    There are two very different questions you could be asking. When you say "to the same number c", do you mean the exact same number? Or do you mean some number with just as many beginning zeroes? Those are two very different questions that address very different types of threats and have very different answers. – David Schwartz Feb 25 at 0:24
  • I mean exactly the same number – Michał Kuczyński Feb 25 at 0:33
2

My question is: Say I know that the message b 'added' with the number a gets mapped to my desired output. Why is it not possible for me, given a different block (b2) to find a corresponding number (a2), such that the hash of the result will map to the same number c?

It's not possible because there are 2^256 (approximately 1 followed by 77 zeroes) possible hash results. You would have to try an awful lot of possible values for a2 to find one that happened to produce precisely the same hash output. The stars would burn out first.

What is the operation that combines the block b with the number a that makes this impossible? Is it simple appending?

No, it is not simple appending. That would produce very, very long numbers. It's an operation that has three important characteristics:

  1. It produces an output smaller than its input. This makes it irreversible because information is lost. You cannot reverse the hashing operation just as you cannot reverse addition. If I add two numbers and get 10, you cannot tell me which two numbers I added because that information has been lost.

  2. A small change in the input produces large changes in the output. That is, changing a single bit of the input changes roughly half of the bits of the output, and it is not easily predictable which bits that will be. It mixes the input quite thoroughly to produce its output.

  3. The output is long, 256 bits. As a result, brute force trial and error to get particular outputs is not practical.

You can read more on the SHA-2 family of functions (which includes SHA-256) here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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