# With the payload, start from the rightmost digit. Moving left, double the value of every second digit (including the rightmost digit).
# Sum the values of the resulting digits.
# The check digit is calculated by <math>(10 - (s \operatorname{mod}bmod 10)) \operatorname{mod}bmod 10</math>, where s is the sum from step 3. This is the smallest number (possibly zero) that must be added to <math>s</math> to make a multiple of 10. Other valid formulas giving the same value are <math>9 - ((s + 9)\operatorname{mod}bmod 10)</math>, <math>(10 - s)\operatorname{mod}bmod 10</math>, and <math>10\lceil s/10\rceil - s</math>. Note that the formula <math>(10 - s)\operatorname{mod}bmod 10</math> will not work in all environments due to differences in how negative numbers are handled by the [[modulo]] operation.