(i) 18 identity card number structure
The citizenship number is a characteristic combination code, which consists of a 17 digit ontology code and a check code.
The order is from left to right: six digit address code, eight digit birth date code, three digit sequential code and one check code.
1. Address Code
Indicates the code object the administrative area of the county (city, Flag, district) where the permanent residence account is located, and executes according to the GB/T2260 regulations.
2. Birth date Code
Indicates the year, month, and day of the encoding object's birth, which is executed according to gb/t7408, and the year, month, and day codes are not separated by delimiters.
3. Sequential code
Indicates the sequence number assigned to a person born in the same same address code, the same month and the same day, and the odd distribution of order codes to men, even to females.
4, check code calculation steps
(1) The weighted summation formula of 17-digit body code
S = SUM (Ai * Wi), i = 0, ..., 16, first the sum of the first 17 digits
Ai: Indicates the ID number value of position I (0~9)
Wi:7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 (representing the weighting factor in position I)
(2) Computational model
Y = mod (S, 11)
(3) According to the model, find the corresponding check code
Y:0 1 2 3 4 5 6 7 8 9 10
Check code: 1 0 X 9 8 7 6 5 4 3 2
(ii) acquisition of the last calibration Code program based on the 17-digit ontology code
Copy Code code as follows:
public class Id18 {
Int[] weight={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2}; 17 Digit Body Code weight
char[] validate={' 1 ', ' 0 ', ' X ', ' 9 ', ' 8 ', ' 7 ', ' 6 ', ' 5 ', ' 4 ', ' 3 ', ' 2 '}; MOD11, corresponding parity code character value
Public Char Getvalidatecode (String id17) {
int sum=0;
int mode=0;
for (int i=0;i<id17.length (); i++) {
Sum=sum+integer.parseint (string.valueof (Id17.charat (i))) *weight[i];
}
mode=sum%11;
return Validate[mode];
}
public static void Main (string[] args) {
Id18 test=new Id18 ();
SYSTEM.OUT.PRINTLN ("The ID Card Verification code:" +test.getvalidatecode ("14230219700101101")); The ID check code: 3
}
}
(iii) Description
1. The program can obtain the corresponding verification code according to the existing 17-bit number ontology code.
2. The program can eliminate the wrong authentication code ID number.
The 3.15-digit ID card was born in the year after 2 digits, without the last 1-bit parity code.
4. Full ID 18 digits, the last check digit may be not a number. One of our projects, the database holds the first 17 digits, so that some SQL statements (such as inner JOIN) have accelerated!!!