A blog about Ruby, Rails and other Tech. Mostly.
Back to blog
How the checksum digit is calculated in a henkilötunnusIn Finland the "Personal ID number" (Sosiaaliturvatunnus (SOTU), or Henkilötunnus (HETU)) is used for identifying the citizens in many government and civilian systems. It uses the form DDMMYYCZZZQ, where DDMMYY is the date of birth, C is the century identification sign (+ for the 19th century, - for the 20th and A for the 21st), ZZZ is the personal identification number (even for females, odd for males) and Q is a checksum character. For example, a valid henkilötunnus is 311280-999J.
The checksum character is calculated thus: Take the birth date and person number, and join them into one 9-digit number x. Let n = x mod 31. Then the checksum letter is the the (n+1)th character from this string: "0123456789ABCDEFHJKLMNPRSTUVWXY".
Back to blog |