Mainland 18 ID Card (second-generation ID card)
Identity number is a set of feature combination code, consisting of 17-bit digital body code and a check code.
The sorting order is from left to right: six-digit area code, eight-digit birthday code, three-digit sequence code, and one digit check code.
Check method:
(1) The first 17 digits of the right sum
S = Sum (Ci * Vi), i = 0, ..., 16
Ci: Numeric value indicating position I on ID number
Vi: denotes "weighted factor" at position I
Weighting Factor Vi:7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
(2) Computational modulus (fixed algorithm)
Y = mod (S, 11)
(3) The calculation module y and the corresponding check code check
Y:0 1 2 3 4 5 6 7 8 9 10 (through Y to obtain the corresponding check code and identity card 18th digit check)
Check code: 1 0 X 9 8 7 6 5 4 3 2
functioncheck_id (value) {varArrexp = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];//weighting Factor varArrvalid = [1, 0, "X", 9, 8, 7, 6, 5, 4, 3, 2];//Check Code if(/^\d{17}\d|x$/i.test (value)) { varsum = 0, IDX; for(vari = 0; i < value.length-1; i++){ //sum the first 17 digits with the weight value productSum + = parseint (Value.substr (i, 1), 10) *Arrexp[i]; } //computational modulus (fixed algorithm)IDX = sum% 11; //Check whether the 18th is equal to the check code returnARRVALID[IDX] = = Value.substr (17, 1). toUpperCase (); }Else{ return false; } }
Bill: jquery check China ID number