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

NAME

6       CheckDigits::M11_003 - compute check digits for PKZ (GDR)
7

SYNOPSIS

9         use Algorithm::CheckDigits;
10
11         $pkz = CheckDigits('pkz');
12
13         if ($pkz->is_valid('150765400354')) {
14               # do something
15         }
16
17         $cn = $pkz->complete('15076540035');
18         # $cn = '150765400354'
19
20         $cd = $pkz->checkdigit('150765400354');
21         # $cd = '4'
22
23         $bn = $pkz->basenumber('150765400354');
24         # $bn = '150765400354'
25

DESCRIPTION

27   ALGORITHM
28       1.  The checkdigit is set to 0.
29
30       2.  From right to left the digits are weighted (multiplied) with
31           2,4,8,5,10,9,7,3,6,1,2,4.
32
33       3.  The products are added.
34
35       4.  The sum of step 3 is taken modulo 11.
36
37       5.  The value of step 4 is added to a multiple (0..9) of the weight of
38           the checkdigit (2).
39
40       6.  The sum of step 5 is taken modulo 11.
41
42       7.  The checkdigit is the multiple of the weight of the checkdigit
43           where the value of step 6 equals 10.
44
45       8.  If there can't be reached a value of 10 in step 6, the number
46           cannot be taken as a PKZ.
47
48       To validate a PKZ apply steps 2 to 4 to the complete number.
49
50   METHODS
51       is_valid($number)
52           Returns true only if $number consists solely of numbers and the
53           last digit is a valid check digit according to the algorithm given
54           above.
55
56           Returns false otherwise,
57
58       complete($number)
59           The check digit for $number is computed and concatenated to the end
60           of $number.
61
62           Returns the complete number with check digit or '' if $number does
63           not consist solely of digits and spaces.
64
65       basenumber($number)
66           Returns the basenumber of $number if $number has a valid check
67           digit.
68
69           Return '' otherwise.
70
71       checkdigit($number)
72           Returns the checkdigit of $number if $number has a valid check
73           digit.
74
75           Return '' otherwise.
76
77   EXPORT
78       None by default.
79

AUTHOR

81       Mathias Weidner, "<mamawe@cpan.org>"
82

SEE ALSO

84       perl, CheckDigits, www.pruefziffernberechnung.de.
85
86
87
88perl v5.28.1                      2019-02-02Algorithm::CheckDigits::M11_003(3)
Impressum