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.

43 lines
1.0 KiB

  1. #!/usr/bin/perl
  2. #
  3. # Intent:
  4. # testing it !
  5. #
  6. # Note:
  7. # This work has been done during my time at Doctor I·T
  8. #
  9. # -- Copyright drit, 2021 --
  10. #
  11. BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
  12. printf "// initialization $0\n";
  13. #use if -e $LIB, $LIB.'/seed';
  14. use seed qw(rand64);
  15. use toychain qw(hashcash);
  16. printf "// testing $0\n";
  17. &seed::setseed(0x2f392c85);
  18. # f96885aa : 21.4min
  19. # 044ce1de : 20.5min
  20. my $n0 = rand64(); # n < 18446744073709551616
  21. printf "n0:%s\n",$n0;
  22. #my ($hc,$n) = &hashcash('SHA256','some data',12131054599640746025,6);
  23. #my ($hc,$n) = &hashcash('SHA256','some data',12131054600136590019,8);
  24. my ($hc,$n) = &hashcash('SHA256','some data',12131054604673102375,9);
  25. printf "hc: %s %s %s\n",unpack('H*',$hc),$n,unpack'H*',pack('Q',$n);
  26. #($hc,$n) = &hashcash('SHA256','hello world',$n0,5);
  27. #printf "hc: %s %x %s\n",unpack('H*',$hc),$n,unpack'H*',pack('Q',$n);
  28. #my ($hc,$n) = &hashcash('SHA256','hello world',$n0,'abcdef');
  29. #printf "hc: %s %x %s\n",unpack('H*',$hc),$n,unpack'H*',pack('Q',$n);
  30. printf "// done $0\n";
  31. exit $?;
  32. 1;