Algorithm-Verhoeff

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension Algorithm::Verhoeff.

0.1  Mon Sep 27 21:01:12 2004
	- original version
0.2  Sun Oct 3 23:31:00 2004
	- documentation fixes
0.3  Wed Dec 29 17:00:00 2004
	- Fixed perl version requirements to only require version 5.0 or better

README  view on Meta::CPAN


Using numbers that pass the verhoeff check is useful for things like product
codes. This is because such numbers almost never pass the verhoeff check if they
as mis-typed. This includes common typos such as ommitted or repeated digits,
transposed digits and so on.

Since it only adds a single digit onto what might already be a longish number,
it's a good algorithm for use where humans need to enter or read the numbers.

To generate such a number, pick a starting number, call verhoeff_check() to get
a check digit, and then APPEND that digit to the end of the original number.

The new number will how pass the verhoeff_check(). 


INSTALLATION

To install this module type the following:

   perl Makefile.PL
   make

lib/Algorithm/Verhoeff.pm  view on Meta::CPAN

Using numbers that pass the verhoeff check is useful for things like product codes.
This is because such numbers almost never pass the verhoeff check if they as mis-typed.
This includes common typos such as ommitted or repeated digits, transposed digits and so on.
Since it only adds a single digit onto what might already be a longish number, it's
a good algorithm for use where humans need to enter or read the numbers.

When we say 'number' we really mean 'string of digits' since that is what the Verhoeff
algorithm works on.

To generate such a number, pick a starting number, call verhoeff_check() to get a check digit,
and then APPEND that digit to the end of the original number. Do NOT add the digit arithmetically
to the original number.

The new number will how pass the verhoeff_check(). In other words, if verhoeff_check()
is called with the new number as its argument, it will return 1. If it is called with
a mistyped version of the original number it will (very probably) return 0. For common
forms of typo such as ommitted digits, accuracy is over 99%.

=head2 verhoeff_get($number)

verhoeff_get accepts a number or string as an argument, and returns a check digit between 0 and 9.


=head2 verhoeff_check($number)

verhoeff_check accepts a number of string as an argument, and returns 1 if it passes the check, or 0 otherwise.



( run in 0.295 second using v1.01-cache-2.11-cpan-069f9db706d )