Math-Base-Convert
view release on metacpan or search on metacpan
lib/Math/Base/Convert/Shortcuts.pm view on Meta::CPAN
#
# number of digits to pad string so the last digit fits exactly in a 32 bit register
# $pad = digits_per_reg - (string_length % $dpr)
my $dpr = int (32 / $bp);
my $pad = $dpr - ($len % $dpr);
$pad = 0 if $pad == $dpr;
if ($pad) {
$str = ($padchar x $pad) . $str; # pad string with zero value digit
}
# number of iterations % digits/register
$len += $pad;
my $i = 0;
my @d32;
while ($i < $len) {
#
# base16 digit = sub bx[base power](string fragment )
# where base power is the width of each nibble and
# base is the symbol value width in bits
$useFROMbaseShortcuts[$bp]->(substr($str,$i,$dpr),\@d32,$hsh);
( run in 1.470 second using v1.01-cache-2.11-cpan-71847e10f99 )