The 18 identity card standards made a clear provision in GB11643-1999 "Citizen ID" implemented on July 1, 1999. GB11643-1999 "Citizenship Number" is the revision of the "Social Security Number", which points to the original standard name "Social Security Number" is renamed "Citizenship Number", and the GB11643-1999 "Citizen ID Number" Instead of GB11643-1989 from the date of implementation. GB11643-1999 The main contents of "Citizenship Number" are as follows: 1. Range The standard specifies the coding object, number of citizen numbers, and the structure and performance form of the number, enabling each encoding object to get a unique, unchanged legal number. Second, the encoding object of coding object citizenship number is a citizen with nationality of the People's Republic of China. Third, the structure and representation of the number 1, the number of the citizenship number of the number is the characteristic group code, consisting of the seventeenth digital body code and a check code. Arrange the order from left to right as: six digit address code, eight digit born date code, three digital sequence code and one digital check code. 2, address code represents administrative division code of the county (city, flag, district) of the coded object, and is implemented in accordance with the provisions of GB / T2260. 3. The birth date indicates the year, month, day, and according to the provisions of the GB / T7408, the year, month, and Japanese code shall not be separated from the date, month, month. 4, the sequence code indicates the sequence number of the same year, the same month, the same day, the odd number of the sequence code, the odd number of sequence codes, the odd number of sequence codes to women, even if the sequence code is assigned to the male.
5, check code (1) seventeen digital body code weighted summation and formula S = SUM (AI * Wi), i = 0, ..., 16, first on the top 17 digits and AI: Identity card number in the first location WI: Represents Weighted Factor Wi: 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2 (2) Calculation Mode Y = Mod (s, 11) (3) Get 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, for example, as follows: Beijing Chaoyang District : 11010519491231002X Shantou City, Guangdong Province: 440524188001010014 following is the program code: private string CheckCidInfo (string cid) {string [] aCity = new string [] {null, null, null, null, null, null, null, null, null, null , NULL, "Beijing", "Tianjin", "Hebei", "Shanxi", "Inner Mongolia", NULL, NULL, NULL, NULL, NULL, "Liaoning", "Jilin", "Heilongjiang", NULL, NULL, NULL , NULL, NULL, NULL, NULL, "Shanghai", "Jiangsu", "Zhejiang", "Anwei", "Fujian", "Jiangxi", "Shandong", NULL, NULL, "Henan", "Hubei" "," Hunan "," Guangdong "," Guangxi "," Hainan ", NULL, NULL, NULL," Chongqing "," Sichuan "," Guizhou "," Yunnan "," Tibet ", NULL, NULL, NULL, Null, NULL, NULL, "Shaanxi", "Gansu", "Qinghai", "Ningxia", "Xinjiang", NULL, NULL, NULL, NULL, NULL, "Taiwan", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL Null, NULL, NULL, NULL, "Hong Kong", "Macau", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Foreign"}; Double ISUM = 0; String Info = ""; System. Text.RegularExpressions.Regex rg = new system.text.regularexpressions.Regex (@ "^ / d {17} (/ d | x) $"); system.text.regularexp Rg.match (CID); if (! mc.success) {return "";} CID = Cid.tolower (); CID = Cid.Replace ("x", "x", "a"); if ( ACITY [INT.SUBSTRING (0, 2))] == NULL) {Return "illegal area";} try {datetime.parse (Cid.Substring (6, 4) "-" Cid.Substring (10, 2) "-"
Cid.Substring (12, 2));} catch {return "illegal birthday";} for (int i = 17; i> = 0; i -) {isum = (system.math.pow (2, I)% 11) * int.Parse (CID [17-i] .tostring (), system.globalization.numberStyles.HexNumber;} if (isum% 11! = 1) Return ("illegal certificate number); RETURN (ACITY [INT.PARSE (Cid.Substring (0, 2))] "," Cid.Substring (6,4) "-" Cid.Substring (10, 2) "-" CID. Substring (12, 2) "," (int.parse (16, 1))% 2 == 1¡ "Men": "Female"));} Call Test: Response.write (CheckcidInfo ("340524198002300019)); Response.write (CHECKCIDINFO (" 34052419800101001x ")); for 15-bit authentication, it can rise to 18 times before it is verified, because it has been very busy, there is no way to write 15-" 18 method The rules are announced: According to the provisions of the citizen identity number in the National Standard GB 11643-1999, the citizen identity number is the characteristic combination code, consisting of the seventeenth digital body code and a digital check code. Arrange the order from left to right as: six digit address code, eight digit born date code, three digital sequence code and one digital check code. The address code represents the administrative region of the county (city, flag, district) in the county (city, flag, district) of the coding object. The birthday period indicates the year, month, day of the birthday, month, and the year, the year, the year, month, and day without separator. The sequence code indicates the sequence number of the person born in the same year, month, and day. The odd number of sequence codes is given to men, even giving women. The check code is based on the seventeenth digit of the previous seventeen digits, calculated by the ISO 7064: 1983.MOD 11-2 check code. The calculation method will be described below. 15 identity card encoding first expanded the birth year to 4 digits, simple is to increase a 19, but this is not used for people born in 1900 (such a birthday star) a male citizen identity number of the body code is 34052419800101001, First, according to formula (1): σ (ai × Wi) (MOD 11) .......................................... (1) Formula (1): i ---- means number characters from Left includes a location number within the check code; AI ---- represents the number character value at the first location; Wi ---- showing the weighting factor at the i-th position, its numerical value according to formula Wi = 2 (N- 1) (MOD 11) is calculated.