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

NAME

6       CheckDigits::M16_001 - compute check digits for ISAN
7

SYNOPSIS

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

DESCRIPTION

27   ALGORITHM
28       1.  "a(1) = 16"
29
30           "b(i) = a(i) % 17 +d(i)", where d(i) is the decimal value of the
31           hexdigit at position i.
32
33           "c(i) = b(i) % 16"
34
35           "a(i) = c(i-1) * 2", for i greater than 1
36
37       2.  Beginning left for each i = 1..16, "a", "b", "c" are computed.
38
39       3.  The check digit is the value for "d(16)" where "c(16)" equals 1.
40
41       4.  The check digit is appended as hexadecimal value to the number.
42
43   METHODS
44       is_valid($number)
45           Returns true only if $number consists solely of numbers and the
46           last digit is a valid check digit according to the algorithm given
47           above.
48
49           Returns false otherwise,
50
51       complete($number)
52           The check digit for $number is computed and concatenated to the end
53           of $number.
54
55           Returns the complete number with check digit or '' if $number does
56           not consist solely of digits and spaces.
57
58       basenumber($number)
59           Returns the basenumber of $number if $number has a valid check
60           digit.
61
62           Return '' otherwise.
63
64       checkdigit($number)
65           Returns the checkdigit of $number if $number has a valid check
66           digit.
67
68           Return '' otherwise.
69
70   EXPORT
71       None by default.
72

AUTHOR

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

SEE ALSO

77       perl, CheckDigits, www.pruefziffernberechnung.de.
78
79
80
81perl v5.32.0                      2020-07-28Algorithm::CheckDigits::M16_001(3)
Impressum