From msuinfo!netnews.upenn.edu!news.amherst.edu!nic.umass.edu!noc.near.net!MathWorks.Com!europa.eng.gtefsd.com!library.ucla.edu!ihnp4.ucsd.edu!munnari.oz.au!sol.ccs.deakin.edu.au!peking.gdwb.vic.gov.au!not-for-mail Sat Mar 19 00:20:39 1994 Path: msuinfo!netnews.upenn.edu!news.amherst.edu!nic.umass.edu!noc.near.net!MathWorks.Com!europa.eng.gtefsd.com!library.ucla.edu!ihnp4.ucsd.edu!munnari.oz.au!sol.ccs.deakin.edu.au!peking.gdwb.vic.gov.au!not-for-mail From: mtonkin@gdwb.vic.gov.au (Malcolm Tonkin) Newsgroups: sci.crypt Subject: Self check algorithms - Pro's, Con's & How ? Date: 18 Mar 1994 08:18:54 +1000 Organization: Barwon Water Lines: 184 Distribution: world Message-ID: <2mal0e$vc@thursday.isd.gdwb.vic.gov.au> NNTP-Posting-Host: thursday.isd.gdwb.vic.gov.au Firstly let me say that I am not a mathematician. I am a computer analyst. I am also relatively new to this group and as yet have not seen any discussion about my request........ I am looking for your advice on self check algorithms for assigning suffix check digits to reference numbers such as "Customer numbers" or "Account numbers" and the relative merits of possible algorithms. Our reasons for using them and the algorithms that we currently use are set out below. We are now finalising a functional requirements specification to replace our existing IBM (System/38) based Customer Billing system with a Unix / Ingres solution to run on a network of Sun workstations and servers. Hence we have an opportunity to review our methods. I would appreciate your thoughts to be either posted to this group, or to be emailed to myself in which case I will post a summary of replies. Thanks in anticipation, Malcolm Tonkin. Why we use them: ---------------- Within our Customer Billing system we have for a number of years been using the IBM modulus 10 and modulus 11 algorithms, with we believe, a reasonable level of success in achieving: * Integrity of data provided from payment collection agencies that have no link to our own data base. When the agent's cashiers key in our reference number (including check digit) the agent's computer system ensures that it agrees with the algorithm. * By ensuring that our data base only contains reference numbers that include an integral valid check digit, we are able to reduce the risk of our own staff simply keying in a reference number incorrectly, getting a match in the data base and without due care processing a transaction against the wrong Customer. IBM Modulus 10 self check algorithm ----------------------------------- For each position in the base number, there is a weight factor. Positions are counted from the rightmost digit (not including the check digit). The Modulus 10 weight factor is 2 for positions 1, 3, 5, ...., 31; it is 1 for positions 2, 4, 6, ....., 30 respectively. To compute a Modulus 10 self check digit: 1. Multiply the units position and every alternate position of the base number by 2. 2. Add the digits in the products to the digits in the base number that were not multiplied. 3. Subtract the sum from the next higher number ending in zero to get the self check digit. For example: Base number 6 1 2 4 8 Units position and every 6 2 8 alternate position Multiply by the weight factor, 2 x2 x2 x2 Products 12 4 16 Digits not multiplied 1 4 Add the digits of the products 1 + 2 + 4 + 1 + 6 + and the digits from the base number 1 + 4 = 19 not used for multiplication Next higher number ending in 0 20 Subtract -19 Self check digit 1 The reference number becomes 612481 IBM Modulus 11 self check algorithm ----------------------------------- For each position in the base number, there is a weight factor. Positions are counted from the rightmost digit (not including the check digit). The Modulus 11 weight factors are 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, ...2, 3, 4, 5, 6, 7, 2 for positions 1, 2, .... 31 respectively. To compute a Modulus 11 self check digit: 1. Assign a weight factor to each digit position of the base number. These factors are: 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, ... starting with the units position of the number an progressing toward the high-order digit. For example, the base number 991246351 would be assigned the weight factor as follows: Base number 9 9 1 2 4 6 3 5 1 Weight factors 4 3 2 7 6 5 4 3 2 2. Multiply each digit by its weight factor. 3. Add the products. 4. Divide the sum by 11 5. Subtract the remainder from 11. The difference is the self check digit. For example: Base number 1 3 7 3 9 Weight factors x6 x5 x4 x3 x2 Multiply each digit by its weight factor 6 15 28 9 18 Add the products 6 + 15 + 28 + 9 + 18 = 76 Divide the sum by 11 76/11 = 6 plus a remainder of 10 Subtract the remainder from 11 11 - 10 = 1 Self check digit 1 The reference number becomes 137391 Note: If the remainder in step 4 is zero, the self check digit is zero. If the remainder is 1, the base number has no self check digit; you must make sure that such base numbers are not used. Pro' & Con's: ------------- Mod 10 - Can assign a numeric self check digit to any existing number. Mod 11 - Cannot assign a numeric self check digit to any existing number. -- Malcolm Tonkin Malcolm.Tonkin@BarwonWater.Vic.Gov.Au Information Systems, Barwon Water Phone: +61 52 262541 61-67 Ryrie St Geelong 3220 Australia Fax: +61 52 218236