FiscalCode is a small python script which allows to generate an italian SSN (Codice Fiscale) upon insertion of needed info.
- The first three letters are made up from the first three consonants in the surname. If there are not enough consonants, the vowels will be placed after all the consonants in the surname, coming in the same order they are in the surname. Should the letters in the surname be less than three, 'X'es will be used as filler.
- The second three letters are taken fron the person's name first, second and fourth consonants. Should the name got less than four consonants, the first, second and third are used. Should the name got two or less consonants, the vowel are used in the order they appear in the name. If the name is shorter than three letters, 'X'es will fill the missing letters.
- the first couple of digits represents he last two digits of birth year.
- the ninth character is a letter representing the birth month, according to this table
Month | Letter |
---|---|
January | A |
February | B |
March | C |
April | D |
May | E |
June | H |
July | L |
Agust | M |
September | P |
October | R |
November | S |
December | T |
- The second couple of digits indicates the day of birth. If the person is female, the birth day is increased by 40. This rule allows to discriminate women from men.
- The next four characters are a code representing the city of birth. For people born outside of Italy, this code indicates the country of birth at the time of birth. For example, a person born in Moscow in 1970 will get the code for the Soviet Union, while a person born in Moscow in 2010 will get the code for the Russian Federation. The same stays for Italian cities: a town can be fused with a bigger city, or the town could have become an independent entity prior to the birth of a person. The code used refers to the city existing at the time of birth.
- The last letter is the control character. It is generated by assigning a value to each character accoring to different tables for odd-position or even-position, starting from 1. Those values are then sum up. The remainder of that sum by 26 gives the char to place at the end accoring to the 3rd table.
- Should two individuals happen to obtain the same Fiscal Code via this method, the Italian Tax Agency (Agenzia delle entrate) will substitute some digits with letters, avoiding a phenomen known as "Omocodia". Omocodia is likely to happen with foreigners or people born in some areas where most names and surnames are similar enough to generate the same code.
Charcater | Value | Character | Value | Character | Value | Character | Value |
---|---|---|---|---|---|---|---|
0 | 1 | 9 | 21 | I | 19 | R | 8 |
1 | 0 | A | 1 | J | 21 | S | 12 |
2 | 5 | B | 0 | K | 2 | T | 14 |
3 | 7 | C | 5 | L | 4 | U | 16 |
4 | 9 | D | 7 | M | 18 | V | 10 |
5 | 13 | E | 9 | N | 20 | W | 22 |
6 | 15 | F | 13 | O | 11 | X | 25 |
7 | 17 | G | 15 | P | 3 | Y | 24 |
8 | 19 | H | 17 | Q | 6 | Z | 23 |
Character | Value | Character | Value | Character | Value | Character | Value |
---|---|---|---|---|---|---|---|
0 | 0 | 9 | 9 | I | 8 | R | 17 |
1 | 1 | A | 0 | J | 9 | S | 18 |
2 | 2 | B | 1 | K | 10 | T | 19 |
3 | 3 | C | 2 | L | 11 | U | 20 |
4 | 4 | D | 3 | M | 12 | V | 21 |
5 | 5 | E | 4 | N | 13 | W | 22 |
6 | 6 | F | 5 | O | 14 | X | 23 |
7 | 7 | G | 6 | P | 15 | Y | 24 |
8 | 8 | H | 7 | Q | 16 | Z | 25 |
Remainder | Character | Remainder | Character | Remainder | Character | Remainder | Character |
---|---|---|---|---|---|---|---|
0 | A | 7 | H | 14 | O | 21 | V |
1 | B | 8 | I | 15 | P | 22 | W |
2 | C | 9 | J | 16 | Q | 23 | X |
3 | D | 10 | K | 17 | R | 24 | Y |
4 | E | 11 | L | 18 | S | 25 | Z |
5 | F | 12 | M | 19 | T | ||
6 | G | 13 | N | 20 | U |
Ferruccio Lamborghini born in Renazzo, April 28th, 1916
- Lamborghini -> LMB
- Ferruccio -> FRC
- 1916 -> 16
- April -> D
- 28th -> 28
- Renazzo, part of the municipality of Cento -> C469
- Control char
- L = 4
- M = 12
- B = 0
- F = 5
- R = 8
- C = 2
- 1 = 0
- 6 = 6
- D = 7
- 2 = 2
- 8 = 19
- C = 2
- 4 = 9
- 6 = 6
- 9 = 21
- Sum is 103, the remainder of 103/26 is 25 -> Z
- Final code is: LMBFRC16D28C469Z