Use python realize the ID number verification system

Hurray everyone, but also a pleasant weekend, this birds today to share with you an interesting real items, made with python "National ID number verification and inquiry system", refined interface as follows: 

The system can be implemented to verify the authenticity of the ID number, age, sex, and certification to inquiries, appears to be not very big on, it is actually not very complex, involving knowledge mainly python string processing, spreadsheet literacy and Gui production , for a certain python based friends practiced hand, following a look at how to achieve it!

The first step: ID number parsing

ID No. 18 of the general composition of numbers, the first 6 digits of the address codes, 14 bit code the date of birth to 7, 15 to 17 as order code, 18 bits checksum. 6 address code encoding target account where the counties (cities, districts) administrative division code; 8 yards for the date of birth date of birth; 3 order code for the county (cities, districts) under the jurisdiction of the police station assignment code, the order odd code assigned to male, female assigned to the even-numbered; a checksum is calculated by the formula unity.

The second step: classify and organize the address code corresponding relationship with the county

The more common online, just search for an ID number will return to the county where the address, we need to do is to find all of the correspondence between all happens online already have an existing, but to be a bit prettier, you can go internet to find it, but to keep their eyes open ah, there is a version is wrong, it can not be found can contact me, I have been collated into a table

The third step: verifying the authenticity of the ID number

ID cards last checksum algorithm is as follows:

① front ID number digits 17 are multiplied by different coefficients, from bit 1 to bit 17 coefficients are: 7,910,584,216,379,105,842

② The resulting 17 products are summed.

③ After the addition is divided by 11 and the remainder obtained.

④ remainder may be 012,345,678,910 these digits, the last one corresponding identification check code is 1 0 X 9 8 7 6 5 4 3 2.

Code is implemented as follows:

Step four: Query region

Rules reference first step, python two lines of code to get

Have to say, python is easy

Step five: calculate the age and gender

The same rule with reference to the first step, as follows:

So far, the main function of the project has been achieved, the following finding ways to implement a GUI interface.

Step Six: Making GUI interface

This step is mainly used PyQt5 achieve the following core code I posted:

First of all is the way the grid label and text box to the layout, and the modification of the text box with setStyleSheet

Query button and then set the layout, and then check function (signal) Binding

Followed by a check function in the query results to be displayed in the text box

Finally, set the main window background pictures

So far, the project you're done, you learn it?

But to declare it, search function described in this article are forward queries that premise ID number of known analytical principles from the network, can not guarantee 100% accurate, but can not figure out a reverse personal identification no, it does not involve invasion of privacy issues.

Published 151 original articles · won praise 4 · views 10000 +

Guess you like

Origin blog.csdn.net/weixin_46089319/article/details/105365723