|
NAMEAlgorithm::LUHN - Calculate the Modulus 10 Double Add Double checksumSYNOPSISuse Algorithm::LUHN qw/check_digit is_valid/; $c = check_digit("43881234567"); print "It works\n" if is_valid("43881234567$c"); $c = check_digit("A2C4E6G8"); # this will cause an error print "Valid LUHN characters are:\n"; my %vc = Algorithm::LUHN::valid_chars(); for (sort keys %vc) { print "$_ => $vc{$_}\n"; } Algorithm::LUHN::valid_chars(map {$_ => ord($_)-ord('A')+10} A..Z); $c = check_digit("A2C4E6G8"); print "It worked again\n" if is_valid("A2C4E6G8$c"); DESCRIPTIONThis module calculates the Modulus 10 Double Add Double checksum, also known as the LUHN Formula. This algorithm is used to verify credit card numbers and Standard & Poor's security identifiers such as CUSIP's and CSIN's.You can find plenty of information about the algorithm by searching the web for "modulus 10 double add double". FUNCTION
SEE ALSOAlgorithm::CheckDigits provides a front-end to a large collection of modules for working with check digits.Business::CreditCard provides three functions for checking credit card numbers. Business::CreditCard::Object provides an OO interface to those functions. Business::CardInfo provides a class for holding credit card details, and has a type constraint on the card number, to ensure it passes the LUHN check. Business::CCCheck provides a number of functions for checking credit card numbers. Regexp::Common supports combined LUHN and issuer checking against a card number. Algorithm::Damm implements a different kind of check digit algorithm, the Damm algorithm <https://en.wikipedia.org/wiki/Damm_algorithm> (Damm, not Damn). Math::CheckDigits implements yet another approach to check digits. I have also written a review of LUHN modules <http://neilb.org/reviews/luhn.html>, which covers them in more detail than this section. REPOSITORY<https://github.com/neilb/Algorithm-LUHN>AUTHORThis module was written by Tim Ayers (http://search.cpan.org/search?author=TAYERS).COPYRIGHTCopyright (c) 2001 Tim Ayers. All rights reserved.LICENSEThis program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |