user135732: For an exercise, I'm trying to find a sha256 hash with 11 leading zeroes.
For this reason, I wrote a Python script that basically tries all intergers from 1 to N and brute forces the hash. Now my N is at 16^11.
Am I mistaken or is there a problem with my code as there must be a nonce somewhere between 1 and 16^11 where the hash has 11 leading zeroes?
Thank you for your input!

user208: Every attempted a hash has an independent probability of 1 in 1611 of having 11 leading zeroes.
That means a probability of not finding such a hash after n attempts is equal to the probability that n attempts are all unsuccesful: (1 - 16-11)n
That means the probability that you are successful increases with n, but never reaches 1:

1% chance after 176,807,378,144 attempts (~169.34).
5% chance after 902,361,177,698 attempts (~169.93).
20% chance after 3,925,582,869,332 attempts (~1610.46).
50% chance after 12,193,974,156,573 attempts (~1610.87).
80% chance after 28,313,531,182,477 attempts (~1611.17).
95% chance after 52,701,479,495,622 attempts (~1611.40).
99% chance after 81,015,010,678,098 attempts (~1611.55).
99.9% chance after 121,522,516,017,148 attempts (~1611.70).
...


135732: <p>For an exercise, I'm trying to find a sha256 hash with 11 leading zeroes.</p>
<p>For this reason, I wrote a Python script that basically tries all intergers from 1 to N and brute forces the hash. Now my N is at 16^11.</p>
<p>Am I mistaken or is there a problem with my code as there must be a nonce somewhere between 1 and 16^11 where the hash has 11 leading zeroes?</p>
<p>Thank you for your input!</p>
 208: <p>Every attempted a hash has an <em>independent</em> probability of <em>1</em> in <em>16<sup>11</sup></em> of having 11 leading zeroes.</p>
<p>That means a probability of not finding such a hash after <em>n</em> attempts is equal to the probability that <em>n</em> attempts are all unsuccesful: <em>(1 - 16<sup>-11</sup>)<sup>n</sup></em></p>
<p>That means the probability that you are successful increases with <em>n</em>, but never reaches <em>1</em>:</p>
<ul>
<li><em>1%</em> chance after <em>176,807,378,144</em> attempts (<em>~16<sup>9.34</sup></em>).</li>
<li><em>5%</em> chance after <em>902,361,177,698</em> attempts (<em>~16<sup>9.93</sup></em>).</li>
<li><em>20%</em> chance after <em>3,925,582,869,332</em> attempts (<em>~16<sup>10.46</sup></em>).</li>
<li><em>50%</em> chance after <em>12,193,974,156,573</em> attempts (<em>~16<sup>10.87</sup></em>).</li>
<li><em>80%</em> chance after <em>28,313,531,182,477</em> attempts (<em>~16<sup>11.17</sup></em>).</li>
<li><em>95%</em> chance after <em>52,701,479,495,622</em> attempts (<em>~16<sup>11.40</sup></em>).</li>
<li><em>99%</em> chance after <em>81,015,010,678,098</em> attempts (<em>~16<sup>11.55</sup></em>).</li>
<li><em>99.9%</em> chance after <em>121,522,516,017,148</em> attempts (<em>~16<sup>11.70</sup></em>).</li>
<li>...</li>
</ul>
