GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ALGORITHM::CHECKDIGITS::MBASE_003 (3)

.ds Aq ’

NAME

CheckDigits::MBase_003 - compute check digits for SICI (Serial Item and Contribution Identifier)

CONTENTS

SYNOPSIS



  use Algorithm::CheckDigits;

  $sici = CheckDigits(sici);

  if ($sici->is_valid(0784-8679(20040308)6:<138>2.0.TX;2-H)) {
        # do something
  }

  $cn = $sici->complete(0784-8679(20040308)6:<138>2.0.TX;2-);
  # $cn = 0784-8679(20040308)6:<138>2.0.TX;2-H

  $cd = $sici->checkdigit(0784-8679(20040308)6:<138>2.0.TX;2-H);
  # $cd = H

  $bn = $sici->basenumber(0784-8679(20040308)6:<138>2.0.TX;2-H);
  # $bn = 0784-8679(20040308)6:<138>2.0.TX;2-;



DESCRIPTION

    ALGORITHM

0 In the string describing the number all letters (A-Z) are replaced with numbers 10-35 accordingly. All other non-numbers are replaced by 36.
1 Beginning right the numbers at all odd positions are added.
2 The sum from step 1 is multiplied by 3.
3 Beginning right the numbers at all even positions are added.
4 The sums from step 2 and 3 are added.
5 The sum from step 4 is taken modulo 37.
6 The checksum is 37 minus the sum from step 5 where numbers from 10 to 35 are represented by ’A’ to ’Z’ accordingly and 36 is represented by ’#’.

    METHODS

is_valid($number) Returns true only if the last letter is a valid check letter according to the algorithm given above.

Returns false otherwise,

complete($number) The check letter for $number is computed and appended the end of $number.

Returns the complete number with check letter or ’’.

basenumber($number) Returns the basenumber of $number if $number has a valid check digit.

Return ’’ otherwise.

checkdigit($number) Returns the check letter of $number if $number has valid check digits.

Return ’’ otherwise.

    EXPORT

None by default.

AUTHOR

Mathias Weidner, <mamawe@cpan.org>

SEE ALSO

perl, CheckDigits, www.pruefziffernberechnung.de, http://sunsite.berkeley.edu/SICI/sici.pdf
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ALGORITHM::CHECKDIGITS::MBASE_003 (3) 2016-03-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.