Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72932 - sandbox/SOC/2011/checks/libs/checks/doc
From: pierre.talbot.6114_at_[hidden]
Date: 2011-07-06 17:22:09


Author: trademark
Date: 2011-07-06 17:22:07 EDT (Wed, 06 Jul 2011)
New Revision: 72932
URL: http://svn.boost.org/trac/boost/changeset/72932

Log:
Explanation of the modulus 10 and 11 algorithm.
Text files modified:
   sandbox/SOC/2011/checks/libs/checks/doc/modulus.qbk | 32 ++++++++++++++++++++++++++------
   1 files changed, 26 insertions(+), 6 deletions(-)

Modified: sandbox/SOC/2011/checks/libs/checks/doc/modulus.qbk
==============================================================================
--- sandbox/SOC/2011/checks/libs/checks/doc/modulus.qbk (original)
+++ sandbox/SOC/2011/checks/libs/checks/doc/modulus.qbk 2011-07-06 17:22:07 EDT (Wed, 06 Jul 2011)
@@ -1,19 +1,39 @@
 [section:modulus Modular sum algorithms]
 
-A ['modular sum algorithm] makes the sum of a serie of digits modulo a number.
+A ['modular sum algorithm] computes the sum of a serie of digits modulo a number.
 The number obtained is called the ['check digit], in many codes it is added as the last digit.
 This rubbish algorithm detect all ['alteration] of one digit but doesn't detect a simple ['transposition] if the check digit is not altered.
-This is why even the most basic algorithms introduced the notion of ['weight]. The weight is the contribution of a number to the final sum.
+This is why even the most basic algorithms introduce the notion of ['weight]. The weight is the contribution of a number to the final sum.
 The following algorithms presented are the base of many, many codes and numbers in the world.
-We could describe a code and his check digit calculation with three characteristics : length, weigth and the modulus.
-So we could design a generic function for every modulus but we won't. It wouldn't be efficient and unnecessarily more complicated.
-The next parts will present the three different algorithms that we have designed.
+We could describe a number and its check digit calculation with three characteristics : length, weigth and the modulus.
+So we could design a generic function but we won't. It wouldn't be efficient and unnecessarily more complicated.
+The next parts will present the three different algorithms that we have choose to design.
 
 [h4 Luhn algorithm]
 
-The Luhn algorithm is well-known
+[h5 Description]
+
+The Luhn algorithm is used with a lot of codes and numbers, the most well-known usage is the verification of the ['credit card numbers].
+It produce a check digit from a sequence with a unlimited length.
+The weigth pattern used is : from the rightmost digit (the check digit) double the value of every second digit.
+It use a modulus 10 on the sum, the range of the check digit is from 0 to 9.
+
+[note When a digit is doubled, we subtract 9 from the result if it exceeds 9]
 
 [h4 Modulus 10 algorithm]
+
+[h5 Description]
+
+This algorithm use a modulus 10 such as the Luhn algorithm but use a custom weight pattern.
+The sum is made without subtraction if the multiplication of a digit exceeds 9.
+The custom weight pattern is interresting for many codes and numbers that aren't implemented in the high level library.
+The user can easily craft his own check function with this weight pattern.
+
 [h4 Modulus 11 algorithm]
 
+The modulus 11 algorithm use a modulus of 11, so we have 11 possible check digits.
+The ten first characters are the figures from 0 to 9, the eleventh is a special character choose by the designer of the number. It is typically 'X' or 'x'.
+The weight of a digit is related to its position. The weight of the first character is the total length of the number - with the check digit included.
+The weight decrease by one for the second position, one again for the third, etc.
+
 [endsect][/section:modulus Modular sum algorithms]
\ No newline at end of file


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk