You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
792 B
39 lines
792 B
#!/usr/bin/perl
|
|
|
|
#
|
|
# Intent:
|
|
# testing it !
|
|
#
|
|
# Note:
|
|
# This work has been done during my time at Doctor I·T
|
|
#
|
|
# -- Copyright drit, 2021 --
|
|
#
|
|
BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
|
|
|
|
printf "// initialization $0\n";
|
|
#use if -e $LIB, $LIB.'/seed';
|
|
use seed qw(rand64);
|
|
use toychain qw(hashcash);
|
|
|
|
printf "// testing $0\n";
|
|
|
|
&seed::setseed(0x2f392c85);
|
|
|
|
# f96885aa : 21.4min
|
|
# 044ce1de : 20.5min
|
|
my $n0 = rand64(); # n < 18446744073709551616
|
|
printf "n0:%s\n",$n0;
|
|
|
|
|
|
my ($hc,$n) = &hashcash('SHA256','hello world',$n0,5);
|
|
printf "hc: %s %x %s\n",unpack('H*',$hc),$n,unpack'H*',pack('Q',$n);
|
|
#my ($hc,$n) = &hashcash('SHA256','hello world',$n0,'abcdef');
|
|
#printf "hc: %s %x %s\n",unpack('H*',$hc),$n,unpack'H*',pack('Q',$n);
|
|
|
|
printf "// done $0\n";
|
|
|
|
exit $?;
|
|
|
|
|
|
1;
|