Crypt-PerfectPaperPasswords
view release on metacpan or search on metacpan
lib/Crypt/PerfectPaperPasswords.pm view on Meta::CPAN
return $GOT_BIGINT = eval 'use Math::BigInt; 1' ? 1 : 0;
}
}
sub _alpha_encode {
my ( $self, $data, $bytes ) = @_;
my $code;
if ( _got_bigint() && $bytes > 4 ) {
# Make a big hex constant
$code = Math::BigInt->new(
'0x'
. join( '',
map { sprintf( "%02x", ord( $_ ) ) } reverse split //, $data )
);
}
else {
$code = unpack( 'V', $data . "\0" x ( 4 - length $data ) );
}
my $limit = 2**( $bytes * 8 );
my @alphabet = split //, $self->alphabet;
my $code_space = @alphabet;
my @out = ();
my $max = 1;
while ( $max < $limit ) {
push @out, $alphabet[ $code % $code_space ];
$code = int( $code / $code_space );
$max *= $code_space;
}
return join '', @out;
}
1;
__END__
=head1 CONFIGURATION AND ENVIRONMENT
Crypt::PerfectPaperPasswords requires no configuration files or environment variables.
=head1 DEPENDENCIES
L<Crypt::Rijndael>
L<Digest::SHA256>
L<Scalar::Util>
L<Time::HiRes>
L<Math::BigInt> (optional)
=head1 INCOMPATIBILITIES
None reported.
=head1 BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to
C<bug-crypt-perfectpaperpasswords@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Andy Armstrong C<< <andy@hexten.net> >>
Original Perfect Paper Passwords implementation by Steve Gibson. More details
here:
http://www.grc.com/ppp.htm
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2007, Andy Armstrong C<< <andy@hexten.net> >>.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
( run in 0.538 second using v1.01-cache-2.11-cpan-39bf76dae61 )