Authen::PIN
Authen::PIN - Create and verify strong PIN numbers
use Authen::PIN;
my $pinset = new Authen::PIN ('PPPCCP123HHHHHHHV',
$start # Optional
);
$pinset->set($start); # Preferred
$pinset->inc($inc);
$pinset->pin($pass_through, $serial);
# OR
$pinset->pin($serial); # undef $pass_through
This module provides an interface to create crypto-strong PIN numbers for applications such as calling cards that require a number that is difficult to guess and that might convey hidden information.
It is based on templates, that define how the resulting PIN number will be constructed by combining the following components:
->pin is
too short, it will be left-padded with zeros.
->set or $start
(if specified) and is incremented for each call to ->pin by
whatever value was passed to ->inc (or 1 by default).
->pin($pass, $serial), the concatenation of $pass and
$serial are passed through the MD5 function and the result
converted to a string of digits. This string is replaced, from left to
right, into the supplied template. There is a limit in the number of
digits that a hash can generate. Using more than 20 or so digits is
discouraged as this might result in PIN numbers that are not strong
enough. In practice, a PIN number with such a large number of digits
is probably of little use.
Luis E. Munoz <lem@cantv.net>
This code has the same warranty that Perl itself.
perl(1), Digest::MD5.