Member
- Joined
- Oct 14, 2023
- Messages
- 225
- Thread Author
- #1
All check digits are calculated as the remainder of the division by 10 of the sum of the weighted character values. The weighting factors are a looped sequence (7,3,1,7,3,1, ...) In the case of an empty string, a fill character (<) can be used instead of a check digit
Consider further how this applies to different types of passports.
Passport of a citizen of the Russian Federation of a new sample
The rules for the formation of the MCHZ are described in the appendix to the order N 279 of the FMS of Russia dated June 30, 2011 [3] [4]. The nuances are as follows:
1) surname, name, patronymic are transliterated using the established table. The resulting string is truncated if necessary.
2) the passport number (in the MCHZ categories) is formed by concatenating the series (without the last digit) and the actual passport number in terms of the FMS.
3) no expiration date is specified (placeholder characters <)
4) the personal number is formed by concatenating the last digit of the series, the date of issue of the passport, the code of the FMS unit that issued the passport and the filler sign.
Passport of the Russian Federation of the old model
Nuances:
1) Patronymic is not entered
2) Personal number is not entered, instead of the corresponding check digit, a placeholder (<) is entered
Russian foreign passport of a new sample (biometric)
Filling in the MCHZ is carried out by analogy with the old-style passport, but 0 is indicated as the check digit of the personal number (symbol 43 of the second line)
As you can see, the MCHZ format and the checksum generation algorithm are quite simple, but each time manually filling the MCHZ, constantly consulting the standards, is rather inconvenient. Therefore, a web application is offered to your attention, which allows you to generate the corresponding MCHZ based on the input data, as well as check the MCHZ for correctness. The application is written in python (version 2.7) using the micro (or even nano) bottle framework. The front end uses bootstrap for beauty and jQuery for interactive filtering of input, so it is advisable to enable javascript in the browser. The focus on the user using the browser made it quite easy to use the font set by the standard. Paranoid people can run an application with disabled javascript or access to the network, but then I will not see an extraordinary title.
Using the app
1) bottle installation (possibly inside a virtual environment)
Code:
pip install bottle
2) launching the application
Code:
python app.py
3) opening the page
Code:
localhost: 5000
4) selection of a menu item, data entry
5) profit!
Further ideas for the application
1) add automatic transliteration for passports
2) it is probably worth rewriting in Flask using WTForms for improved verification of entered data.
3) think about the possibility of describing a passport of an arbitrary country through the enumeration of fields (analogous to models in Django)
4) think about changing the interface (try tkinter or qt)
5) add the generation of MCHZ in the form of a raster file for further layout with the choice of the desired resolution
Some conclusions
1) string fields (full name, gender) do not have a check digit, there is nothing to worry about when editing them
2) if, when publishing a scan of a document for any purpose, you paint over the installation data, do not forget about their duplicate in the Ministry of Health
3) you can judge on your own about the truthfulness of urban legends about the numbers in the passport (supposedly the last figure means either the number of people similar to the owner, or the category of accounting "where necessary", etc.).
Footnotes:
[1] (clearnet)
[2] (clearnet)
[3] (clearnet)
[4] (clearnet)
Consider further how this applies to different types of passports.
Passport of a citizen of the Russian Federation of a new sample
The rules for the formation of the MCHZ are described in the appendix to the order N 279 of the FMS of Russia dated June 30, 2011 [3] [4]. The nuances are as follows:
1) surname, name, patronymic are transliterated using the established table. The resulting string is truncated if necessary.
2) the passport number (in the MCHZ categories) is formed by concatenating the series (without the last digit) and the actual passport number in terms of the FMS.
3) no expiration date is specified (placeholder characters <)
4) the personal number is formed by concatenating the last digit of the series, the date of issue of the passport, the code of the FMS unit that issued the passport and the filler sign.
Passport of the Russian Federation of the old model
Nuances:
1) Patronymic is not entered
2) Personal number is not entered, instead of the corresponding check digit, a placeholder (<) is entered
Russian foreign passport of a new sample (biometric)
Filling in the MCHZ is carried out by analogy with the old-style passport, but 0 is indicated as the check digit of the personal number (symbol 43 of the second line)
As you can see, the MCHZ format and the checksum generation algorithm are quite simple, but each time manually filling the MCHZ, constantly consulting the standards, is rather inconvenient. Therefore, a web application is offered to your attention, which allows you to generate the corresponding MCHZ based on the input data, as well as check the MCHZ for correctness. The application is written in python (version 2.7) using the micro (or even nano) bottle framework. The front end uses bootstrap for beauty and jQuery for interactive filtering of input, so it is advisable to enable javascript in the browser. The focus on the user using the browser made it quite easy to use the font set by the standard. Paranoid people can run an application with disabled javascript or access to the network, but then I will not see an extraordinary title.
Using the app
1) bottle installation (possibly inside a virtual environment)
Code:
pip install bottle
2) launching the application
Code:
python app.py
3) opening the page
Code:
localhost: 5000
4) selection of a menu item, data entry
5) profit!
Further ideas for the application
1) add automatic transliteration for passports
2) it is probably worth rewriting in Flask using WTForms for improved verification of entered data.
3) think about the possibility of describing a passport of an arbitrary country through the enumeration of fields (analogous to models in Django)
4) think about changing the interface (try tkinter or qt)
5) add the generation of MCHZ in the form of a raster file for further layout with the choice of the desired resolution
Some conclusions
1) string fields (full name, gender) do not have a check digit, there is nothing to worry about when editing them
2) if, when publishing a scan of a document for any purpose, you paint over the installation data, do not forget about their duplicate in the Ministry of Health
3) you can judge on your own about the truthfulness of urban legends about the numbers in the passport (supposedly the last figure means either the number of people similar to the owner, or the category of accounting "where necessary", etc.).
Footnotes:
[1] (clearnet)
You do not have permission to view link
Log in or register now.
[2] (clearnet)
You do not have permission to view link
Log in or register now.
[3] (clearnet)
You do not have permission to view link
Log in or register now.
[4] (clearnet)
You do not have permission to view link
Log in or register now.