Closed try2benice closed 3 years ago
Hi
Yes, it's right.
That field is entirely at the discretion of the issuing state, so it's not a special case.
You do not provide any sample, but if the hash used is calculated with the same algorithm that ICAO uses, solution is very simple:
A very simple function:
def od_nld(optional_data):
from mrz.base.functions import hash_string
value = optional_data.ljust(14, "<")
return "%s%s" % (value, hash_string(value))
Now, let's use it with a TD1:
from mrz.generator.td1 import TD1CodeGenerator, hash_string
def od_nld(optional_data):
value = optional_data.ljust(14, "<")
return "%s%s" % (value, hash_string(value))
print(TD1CodeGenerator("I", # Document type Normally 'I' or 'ID' for id cards
"NLD", # Country 3 letters code or country name
"59000002", # Document number Special characters will be transliterated
"870314", # Birth date YYMMDD
"M", # Genre Male: 'M', Female: 'F' or Undefined 'X'
"170102", # Expiry date YYMMDD
"Netherlands", # Nationality
"SPECIMEN", # Surname Special characters will be transliterated
"SVEN", # Given name(s) Special characters will be transliterated
od_nld("try2benice"))) # Optional data1
And Voila!....
I<NLD59000002<8TRY2BENICE<<<<4
8703145M1701027NLD<<<<<<<<<<<0
SPECIMEN<<SVEN<<<<<<<<<<<<<<<<
...Solution without modifying anything
BR
Thanks! I didn't expect any answer this fast. I appreciate it. It solved my problem.
The netherlands ID (TD1) has optional data. at line 1 position 30 there is a hash number. Is there any chance for me to change the script of TD1 for another hash at line 1 pos 30?