<p>As you expected, the answer to both is no :-)</p>

<p>For the generation of hashes: the miner attempts to find an input that, fed into a specified function, gives an output that satisfies certain properties. In Bitcoin the property is that the output is required to have a given number of zeroes. As your peers will recalculate the hash from the input you provide them with (the block) they will notice that the hash does not match the property and discard it. In fact the hash is not even directly relayed, but only the block from which the hash can be calculated.</p>

<p>For the target being unreachable, this question has been <a href="https://bitcoin.stackexchange.com/questions/9933/is-it-possible-for-the-network-to-stop-finding-valid-blocks/9939#9939">asked a number of times before</a>. The gist of it is that <code>H(block) &lt; target</code>. An increase in difficulty  reduces the number of possible solutions, but not the set in which you have to look for them, making it harder to find one.</p>

CC BY-SA 3.0
2013-04-24T10:15:00.610Z
2013-04-24T10:15:00.610Z
2017-04-13T12:47:36.647Z
cdecker
<p>Hashes are one-way functions.  sha256("DataGoesHere") --> HashResult
but given just a HashResult, you cannot then determine what was the value of the data that got hashed. </p>

<p>If you change even one bit of that HashResult (e.g., prefix it with a zero) then that data it corresponds to will be completely different.   So it is easy to get the HashResult.  It is essentially impossible to go the other direction and determine the value of the data.</p>

CC BY-SA 3.0
2013-04-24T09:51:29.393Z
2013-04-24T09:51:29.393Z
Stephen Gornick
<p>A hash function is a mathematical function that is easy to perform in one direction, but for which there is no known way to easily perform in the other direction.</p>

<p>So, why don't you generate a SHA-256 hash and replace the beginning of the hash with zeroes? Because then it wouldn't be the hash anymore. It is (by definition of a hash function) easy for anyone to verify the hash.</p>

<p>Why don't you write a custom SHA-256 program that generates a hash that starts with the prerequisite number of zeros? Because (again, by definition) a hash function means that there is no way to perform the function in the reverse direction: you can't predict the result of the hash (or even part of the hash, such as the leading zeroes.) There's no way to write such a program, otherwise SHA-256 would be considered "broken" and wouldn't be used as a hash.</p>

<p>Essentially what mining is (as described in the linked article) is repeatedly hashing the block, varying only one field called the "nonce". A miner will try millions of possible nonces, hoping that the resulting has the required number of zeroes at the beginning.</p>

CC BY-SA 3.0
2013-04-24T18:21:40.740Z
2013-04-24T18:21:40.740Z
David Ogren
<p>disclaimer: I'm completely new at this, basic computer skills limited to GUI point-&amp;-click</p>

<ol>
<li><p>I took a look at how difficulty was explained, that it is "increased" by requiring the SHA-256 generation of blocks with more leading 0 bits, thus a string of 0s at the start of the hash which is more and more rare. Unless this has not been explained in a way I understand properly I think this means that you can cheat the Bitcoin difficulty and make blocks whenever you want? You simply need a custom SHA-256 hash generation program which non-randomly generates the specified number of 0s followed by a random SHA-256 hash shortened by the number of digits equal to the number of 0s in front, or simply generates a SHA-256 hash and then replaces the leading bits with 0 bits to meet the difficulty target thus forging a block hash. So from what I'm told it's A) easy to cheat; OR B) not well enough explained.</p></li>
<li><p>Isn't higher difficulty less and less secure a block hash because it is less and less random? Like if the difficulty were theoretically to rise high enough wouldn't it require the entire hash to be ONLY 0 bits instead of just the first part? Doesn't that ruin the security of Bitcoin the harder it gets? Hashes are seemingly easier to crack the higher difficulty is, easier to guess randomly and easier to forge. Couldn't I or someone else just spam strings of 0 and be rewarded with blocks just as fast as they could spam enough 0s to complete a hash?</p></li>
</ol>

<p>I realize the answer to both questions is probably "no it's not like that" but that is the way it's been explained on the wiki and wikipedia and various other places.</p>

<p>I think it's more like, miners actually process transactions, not just (or maybe not even because those could be coming from both parties of the transaction) randomly generate hashes. Also there is probably some encryption involved which has not been properly explained and which when difficulty rises is added in many more multiple layers, encrypting and re-encrypting the already encrypted data.</p>

<p>The explanation about 0 strings also doesn't allow for a infinitely variable difficulty above 1 and for this reason it also doesn't seem to make sense.</p>

<p>I'd like more transparency in how the actual technical process is explained even if it's so long that I don't care to read it. It'd also be great to find links to the full publicly released SHA standards and documentation. </p>

<p>The more transparent the security is the more likely it is that someone will find a way to break or breach it if this is possible and while it is not desirable for that to happen it's better that it happen sooner rather than later if it can happen at all. Thus more robust standards blocking that sort of breach can be implemented. </p>

CC BY-SA 3.0
2013-04-24T09:56:38.943Z
ELI5: http://www.reddit.com/r/Bitcoin/comments/1ayf2d
Stephen Gornick
CC BY-SA 3.0
2013-04-24T10:01:42.760Z
Related: http://bitcoin.stackexchange.com/q/4775/153
Stephen Gornick
<security><hash><mining-technical-details>
Why can't just any hash be used for a block?
Rove
# Why can't just any hash be used for a block?

(Asked by: username_0 on 2013-04-24)

disclaimer: I'm completely new at this, basic computer skills limited to GUI point-&-click

1. I took a look at how difficulty was explained, that it is "increased" by requiring the SHA-256 generation of blocks with more leading 0 bits, thus a string of 0s at the start of the hash which is more and more rare. Unless this has not been explained in a way I understand properly I think this means that you can cheat the Bitcoin difficulty and make blocks whenever you want? You simply need a custom SHA-256 hash generation program which non-randomly generates the specified number of 0s followed by a random SHA-256 hash shortened by the number of digits equal to the number of 0s in front, or simply generates a SHA-256 hash and then replaces the leading bits with 0 bits to meet the difficulty target thus forging a block hash. So from what I'm told it's A) easy to cheat; OR B) not well enough explained.
2. Isn't higher difficulty less and less secure a block hash because it is less and less random? Like if the difficulty were theoretically to rise high enough wouldn't it require the entire hash to be ONLY 0 bits instead of just the first part? Doesn't that ruin the security of Bitcoin the harder it gets? Hashes are seemingly easier to crack the higher difficulty is, easier to guess randomly and easier to forge. Couldn't I or someone else just spam strings of 0 and be rewarded with blocks just as fast as they could spam enough 0s to complete a hash?

I realize the answer to both questions is probably "no it's not like that" but that is the way it's been explained on the wiki and wikipedia and various other places.

I think it's more like, miners actually process transactions, not just (or maybe not even because those could be coming from both parties of the transaction) randomly generate hashes. Also there is probably some encryption involved which has not been properly explained and which when difficulty rises is added in many more multiple layers, encrypting and re-encrypting the already encrypted data.

The explanation about 0 strings also doesn't allow for a infinitely variable difficulty above 1 and for this reason it also doesn't seem to make sense.

I'd like more transparency in how the actual technical process is explained even if it's so long that I don't care to read it. It'd also be great to find links to the full publicly released SHA standards and documentation.

The more transparent the security is the more likely it is that someone will find a way to break or breach it if this is possible and while it is not desirable for that to happen it's better that it happen sooner rather than later if it can happen at all. Thus more robust standards blocking that sort of breach can be implemented.

**Tags:** security, hash, mining-technical-details

> **Comments:**
> **username_1**: ELI5: http://www.reddit.com/r/Bitcoin/comments/1ayf2d  
> **username_1**: Related: http://bitcoin.stackexchange.com/q/4775/153  

---

## 3 answers

### Answer by username_2 on 2013-04-24. Score: 1

As you expected, the answer to both is no :-)

For the generation of hashes: the miner attempts to find an input that, fed into a specified function, gives an output that satisfies certain properties. In Bitcoin the property is that the output is required to have a given number of zeroes. As your peers will recalculate the hash from the input you provide them with (the block) they will notice that the hash does not match the property and discard it. In fact the hash is not even directly relayed, but only the block from which the hash can be calculated.

For the target being unreachable, this question has been [asked a number of times before](https://bitcoin.stackexchange.com/questions/9933/is-it-possible-for-the-network-to-stop-finding-valid-blocks/9939#9939). The gist of it is that `H(block) < target`. An increase in difficulty reduces the number of possible solutions, but not the set in which you have to look for them, making it harder to find one.


---

### Answer by username_1 on 2013-04-24. Score: 1

Hashes are one-way functions. sha256("DataGoesHere") --> HashResult
but given just a HashResult, you cannot then determine what was the value of the data that got hashed.

If you change even one bit of that HashResult (e.g., prefix it with a zero) then that data it corresponds to will be completely different. So it is easy to get the HashResult. It is essentially impossible to go the other direction and determine the value of the data.


---

### Answer by username_3 on 2013-04-24. Score: 0

A hash function is a mathematical function that is easy to perform in one direction, but for which there is no known way to easily perform in the other direction.

So, why don't you generate a SHA-256 hash and replace the beginning of the hash with zeroes? Because then it wouldn't be the hash anymore. It is (by definition of a hash function) easy for anyone to verify the hash.

Why don't you write a custom SHA-256 program that generates a hash that starts with the prerequisite number of zeros? Because (again, by definition) a hash function means that there is no way to perform the function in the reverse direction: you can't predict the result of the hash (or even part of the hash, such as the leading zeroes.) There's no way to write such a program, otherwise SHA-256 would be considered "broken" and wouldn't be used as a hash.

Essentially what mining is (as described in the linked article) is repeatedly hashing the block, varying only one field called the "nonce". A miner will try millions of possible nonces, hoping that the resulting has the required number of zeroes at the beginning.


---

