NAME
Number::Encode - Encode bit strings into digit strings
SYNOPSIS
use Number::Encode qw(nonuniform uniform);
DESCRIPTION
Provides a mechanism to convert arbitrary bit-strings into numeric digit strings. The transformation can be uniform or non-uniform depending on the type of distribution of the numeric digits achieved.
The former approach is useful for security-related applications such as calling cards and the such, which require a uniform digit distribution. The algorythm used to generate uniform distributions, while deterministic, is more constly than the non-uniform variant.
This module is distributed under the same terms and warranty as Perl itself.
EXPORT
This module provides the following exports:
my $number = nonuniform($data)
-
Converts a bit-string represented in the example by the scalar
$data
to a numeric string representation returned at$number
.The probabilistic distribution of the digits in the resulting number is not uniform. Some digits will have up to twice the chance of others of appearing at a given position.
my $number = uniform($data)
-
Performs a transformation from the bit-string provided in
$data
to a numeric string returned at$number
. This transformation is a bit more costly but has the advantage that the digit distribution is uniform. This function is adequate for applications that require a uniform composition of the numeric strings, such as password or PIN number generators.
HISTORY
AUTHOR
Luis E. Munoz <lem@cantv.net>
SEE ALSO
perl(1).