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.
 
 
 
 
 
 

31 lines
743 B

BEGIN { if (-e $ENV{SITE}.'/lib') { use lib $ENV{SITE}.'/lib'; } }
use encode qw(encode_basen decode_basen);
my @msg = (
'no work yet !',
'genesis nonce',
'default nonce for block address',
'CAStore nonce',
'initial nonce'
);
for my $msg (@msg) {
print "msg: $msg\n";
my $nonce = unpack 'Q',&decode_basen(lc($msg),29);
printf "nonce: %s\n",$nonce;
printf "nonce16: %s\n",unpack'H*',pack('Q',$nonce);
printf "monce29: %s\n",&encode_basen(pack('Q',$nonce),29);
print ".\n";
}
$msg = &encode_basen("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",29);
printf "msg: %s\n",$msg;
my $m29 = &decode_basen($msg.$msg,29);
printf "m29: %s (%dc)\n",join('_',unpack('Q*',$m29)),length($m29);
printf "m16: %s\n",unpack('H*',$m29);
exit $?;
1;