1Algorithm::CheckDigits:U:sMeXrX_C0o0n3t(r3ipbmu)ted PerlAlDgoocruimtehnmt:a:tCihoenckDigits::MXX_003(3pm)
2
3
4

NAME

6       CheckDigits::MXX_003 - compute check digits for DEM
7

SYNOPSIS

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

DESCRIPTION

27   ALGORITHM
28       The algorithm is a variation of the Verhoeff scheme.
29
30       0   All letters are changed to numbers.
31
32       1   All digits are permutated according to a permutation table.
33
34       2   The permutated digits are combined using a diëder table. The first
35           with the second, the result with the third, this result with the
36           fourth and so on.
37
38       3   The result of the last combination in the diëder table is in such a
39           way combined that the result is 0 (zero). The number used for this
40           combination is the checksum.
41
42       For details look at the source.
43
44   METHODS
45       is_valid($number)
46           Returns true only if $number consists solely of numbers and the
47           last digit is a valid check digit according to the algorithm given
48           above.
49
50           Returns false otherwise,
51
52       complete($number)
53           The check digit for $number is computed and concatenated to the end
54           of $number.
55
56           Returns the complete number with check digit or '' if $number does
57           not consist solely of digits and spaces.
58
59       basenumber($number)
60           Returns the basenumber of $number if $number has a valid check
61           digit.
62
63           Return '' otherwise.
64
65       checkdigit($number)
66           Returns the checkdigit of $number if $number has a valid check
67           digit.
68
69           Return '' otherwise.
70
71   EXPORT
72       None by default.
73

AUTHOR

75       Mathias Weidner, "<mamawe@cpan.org>"
76

THANKS

SEE ALSO

79       perl, CheckDigits, www.pruefziffernberechnung.de,
80
81
82
83perl v5.38.0                      2023-07-2A0lgorithm::CheckDigits::MXX_003(3pm)
Impressum