|
@ -10,11 +10,12 @@ where the difficulities is set to <span id=dif><i>:dif</i></span>. |
|
|
hash algo: <input name="algo" value="SHA256" size="7"> |
|
|
hash algo: <input name="algo" value="SHA256" size="7"> |
|
|
<br>data: <input name="data" value="some data" size=24> |
|
|
<br>data: <input name="data" value="some data" size=24> |
|
|
<!-- perl -Ilib -Mmisc -e 'print $misc::inonce' |
|
|
<!-- perl -Ilib -Mmisc -e 'print $misc::inonce' |
|
|
5: 12131054599640746025 |
|
|
|
|
|
6: 12131054600136000000 |
|
|
|
|
|
8: 12131054604672000000 |
|
|
|
|
|
|
|
|
5: 12131054599640000000 |
|
|
|
|
|
6: 12131054600130000000 |
|
|
|
|
|
8: 12131054604670000000 |
|
|
|
|
|
9: 12131054702320000000 |
|
|
--> |
|
|
--> |
|
|
<br>nonce: <input name="nonce" value="12131054604672000000" size=20> |
|
|
|
|
|
|
|
|
<br>nonce: <input name="nonce" value="12131054702320000000" size=20> |
|
|
<br>difficulty: <input name="dif" value="7" size="2"> |
|
|
<br>difficulty: <input name="dif" value="7" size="2"> |
|
|
<br>hashcash: <span name="hashcash"><i>?</i></span> |
|
|
<br>hashcash: <span name="hashcash"><i>?</i></span> |
|
|
<br>proof: <span id="pow"><i>:pow</i></span> |
|
|
<br>proof: <span id="pow"><i>:pow</i></span> |
|
@ -57,7 +58,7 @@ sub hashcash { # ex: hashcash('SHA256',$data,$nonce,7); |
|
|
my $rate = ($n - $nonce) / $elapse / 1000; |
|
|
my $rate = ($n - $nonce) / $elapse / 1000; |
|
|
#printf "%d: %s %s %s %.0fkH/s %.1fmin\n",$l, $n,unpack('H*',$pn),$h16,$rate,$elapse/60; |
|
|
#printf "%d: %s %s %s %.0fkH/s %.1fmin\n",$l, $n,unpack('H*',$pn),$h16,$rate,$elapse/60; |
|
|
# count any zeros : ($h16 =~ m/0/g) ! |
|
|
# count any zeros : ($h16 =~ m/0/g) ! |
|
|
my $zc = ($h16 =~ /80+/) ? length($&) : 0; |
|
|
|
|
|
|
|
|
my $zc = ($h16 =~ /80*/) ? length($&) : 0; |
|
|
#print "zc: $zc\n"; |
|
|
#print "zc: $zc\n"; |
|
|
$l = $zc; |
|
|
$l = $zc; |
|
|
last if $zc >= $difficulty; |
|
|
last if $zc >= $difficulty; |
|
|