Thursday, July 1, 2010

RSA ID Number Check-Sum Algorithm

infomation sourced from this site.

13 digit South African Identity Numbers have the following format

{YYMMDD}{G}{SSS}{A}{Z}

YYMMDD Date of birth
G Gender: 0-4 = Female, 5-9 = Male
SSS Sequence No. for DOB/G combination.
C Citizenship: 0 = SA, 1 = other
A generally, but not strictly = 8, 9
Z CheckSum Digit

Calculation of Checksum Digit = Z

A = sum of digits in odd position (excluding last checksum digit)
B = sum of all the digits of the product of 2 and the number formed from the original be removing all the odd digits
C = A + B
Z = 10 - (second digit of C)

5 comments:

  1. Anyone know what the algorithm used for Namibia Id documents is?

    ReplyDelete
    Replies
    1. Hi NiceGirl, did you ever find the algorithm used for Namibian ID docs? I am currently busy with a client project that requires ID verification and in search of the Namibian algorithm.

      Delete
    2. see nam id below

      Delete
  2. Hi NiceGirl, did you ever find the algorithm used for Namibian ID docs? I am currently busy with a client project that requires ID verification and in search of the Namibian algorithm.

    ReplyDelete
    Replies
    1. 11-digit numbers
      561024 0013 5 where:
      561025 = Date of birth
      0013 = Serial number (for this date of birth)
      5 = Check digit
      The check digit is based on modulus 11 with a weighting factor of 11, 10, 9, 8, 7, 6, 5, 4, 3, 2 is used. Valid
      check digits are 0 thru 9 inclusive. A check digit of 10 is invalid and not used, in that case the srial number
      is increased by 1 and the cycle repeated until a valid check digit is calculated.
      Example:
      Id number 56102400135
      5 X 11 = 55
      6 X 10 = 60
      1 X 9 = 9
      0 X 8 = 0
      2 X 7 = 14
      4 X 6 = 24
      0 X 5 = 0
      0 X 4 = 0
      1 X 3 = 3
      3 X 2 = 6
      Total: 171
      Check digit: 176 - 171 = 5
      If the total is a multiple of 11, then the check digit becomes 0, otherwise the total is subtracted from the
      next higher multiple of 11 and the remainder becomes the check digit. If the check digit is 10, the serial
      number is increased and the check digit re-calculated.
      When validating the check digit, the total as calculated above, plus the check digit, must be a mulitple of
      11.
      13-digit numbers
      561024 12 0013 5 where:
      561025 = Date of birth
      12 = Population group
      0013 = Serial number (for this date of birth)
      5 = Check digit
      The ID numbers are calculated in exactly the same way as the 11-digit numbers, but with a weighting
      factor of 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2.

      Delete

comment: