<p>If a miner normally has <code>X</code> hashrate so it takes <code>Y</code> time to find a block, and that miner is able to find a preimage attack that results in him finding block in <code>Y/100</code> time, then it would be as if he had <code>100X</code> hashrate. So the attacker would be able to do whatever anyone else with <code>100X</code> hashrate can do. If this is more than 51%, then the attacker can modify the blockchain history and everything else that can be done with >51% of the hashrate.</p>

<blockquote>
  <p>Is it easier to find pre-image for hash that has to start with 4 zeroes than excatly the same hash?</p>
</blockquote>

<p>In terms of a preimage attack, it depends on the hash algorithm.</p>

<p>Via brute force, it is easier because there are more possible values that you can get a preimage for rather than just one specific value.</p>

CC BY-SA 3.0
2018-03-27T17:42:17.033Z
2018-03-27T17:42:17.033Z
Ava Chow
<p>I know that SHA256d is strong enough and it's not likely that will be broken soon but let's say someone knows how to find pre-image. The adversary chooses random hash starting with n zeroes (less than target) and finds pre-image (valid block header), let's say 100 times faster (I know it is possible only in theory) than he would need to do this by mining in classic way. What are the benefits that he gets? I think that he can mine faster, so it is easier for him to acquire over 50% of the network hashrate. He can also modify last n existing blocks to remove his transactions (double spending) and create longer blockchain that will be accepted widely in the network. Am I right?</p>

<p>Second but related question. Let's assume we use 8 bit hash function. Is it easier to find pre-image for hash that has to start with 4 zeroes than excatly the same hash? I mean, is finding pre-image for hash 0000xxxx easier than for example 01010101? In the first example there are exactly 16 hashes that can be accepted.</p>

<hash><sha256>
Is pre-image attack useful for mining?
Some One
# Is pre-image attack useful for mining?

(Asked by: username_0 on 2018-03-26)

I know that SHA256d is strong enough and it's not likely that will be broken soon but let's say username_0 knows how to find pre-image. The adversary chooses random hash starting with n zeroes (less than target) and finds pre-image (valid block header), let's say 100 times faster (I know it is possible only in theory) than he would need to do this by mining in classic way. What are the benefits that he gets? I think that he can mine faster, so it is easier for him to acquire over 50% of the network hashrate. He can also modify last n existing blocks to remove his transactions (double spending) and create longer blockchain that will be accepted widely in the network. Am I right?

Second but related question. Let's assume we use 8 bit hash function. Is it easier to find pre-image for hash that has to start with 4 zeroes than excatly the same hash? I mean, is finding pre-image for hash 0000xxxx easier than for example 01010101? In the first example there are exactly 16 hashes that can be accepted.

**Tags:** hash, sha256


---

## 1 answers

### Answer by username_1 on 2018-03-27. Score: 1

If a miner normally has `X` hashrate so it takes `Y` time to find a block, and that miner is able to find a preimage attack that results in him finding block in `Y/100` time, then it would be as if he had `100X` hashrate. So the attacker would be able to do whatever anyone else with `100X` hashrate can do. If this is more than 51%, then the attacker can modify the blockchain history and everything else that can be done with >51% of the hashrate.

> Is it easier to find pre-image for hash that has to start with 4 zeroes than excatly the same hash?

In terms of a preimage attack, it depends on the hash algorithm.

Via brute force, it is easier because there are more possible values that you can get a preimage for rather than just one specific value.


---

