1Algorithm::CheckDigits:U:sMeXrX_C0o0n1t(r3i)buted Perl DAolcguomreintthamt:i:oCnheckDigits::MXX_001(3)
2
3
4

NAME

6       CheckDigits::MXX_001 - compute check digits for german Personalausweis
7       (pa_de) or ABA routing numbers (aba_rn)
8

SYNOPSIS

10         use Algorithm::CheckDigits;
11
12         $pa = CheckDigits('pa_de');
13
14         if ($pa->is_valid('2406055684D<<6810203<0705109<6')) {
15               # do something
16         }
17
18         if ($pa->is_valid('2406055684') {
19               # do_something
20         }
21
22         $cn = $pa->complete('240605568_D<<681020_<070510_<_');
23         # $cn = '2406055684D<<6810203<0705109<6'
24
25         $cd = $pa->checkdigit('2406055684D<<6810203<0705109<6');
26         # $cd = '6'
27
28         $bn = $pa->basenumber('2406055684D<<6810203<0705109<6');
29         # $bn = '240605568_D<<681020_<070510_<_'
30
31         $aba = CheckDigits('aba_rn');
32         if ($aba->is_valid('789456124')) {
33              # do something
34         }
35

DESCRIPTION

37   ALGORITHM
38       1.  Beginning left all digits are weighted with 7,3,1,7,3,1,... for
39           pa_de or 3,7,1,3,7,1,3,7,1 for aba_rn.
40
41       2.  The sum of those products is computed.
42
43       3.  For pa_de the checksum is the last digit of the sum from step 2
44           (modulo 10).
45
46           For aba_rn the checksum is the difference of the sum from step 2 to
47           the next multiple of 10.
48
49       4.  For the german Personalausweis step 1 to 3 is performed for every
50           part of the number and for all 3 parts including the particular
51           checkdigit to compute the total checksum.
52
53           If the number solely consists of digits, the checksum is just
54           computed once according to algorithm given above.
55
56   METHODS
57       is_valid($number)
58           Returns true only if $number consists solely of numbers and the
59           last digit is a valid check digit according to the algorithm given
60           above.
61
62           Returns false otherwise,
63
64       complete($number)
65           The check digit for $number is computed and concatenated to the end
66           of $number.
67
68           Returns the complete number with check digit or '' if $number does
69           not consist solely of digits and spaces.
70
71       basenumber($number)
72           Returns the basenumber of $number if $number has a valid check
73           digit.
74
75           Return '' otherwise.
76
77       checkdigit($number)
78           Returns the checkdigit of $number if $number has a valid check
79           digit.
80
81           Return '' otherwise.
82
83   EXPORT
84       None by default.
85

AUTHOR

87       Mathias Weidner, "<mamawe@cpan.org>"
88

THANKS

90       Aaron W. West pointed me to a fault in the computing of the check
91       digit. Jim Hickstein made me aware of the ABA routing numbers.
92

SEE ALSO

94       perl, CheckDigits, www.pruefziffernberechnung.de,
95       http://answers.google.com/answers/threadview/id/43619.html,
96       http://www.brainjar.com/js/validation/
97
98
99
100perl v5.30.0                      2019-07-26Algorithm::CheckDigits::MXX_001(3)
Impressum