fix mrz2 checksum calculation

git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@218 f711b948-2313-0410-aaa9-d29f33439f0b
This commit is contained in:
hploetz 2007-06-07 21:15:33 +00:00
parent 19b862ae24
commit bda175ccb2
1 changed files with 2 additions and 5 deletions

View File

@ -820,7 +820,7 @@ class Passport(object):
else:
expanded_document_no = False
self.calculate_check_digit(mrz2[:9], mrz2[9], "Document number")
self.nationality = mrz2[10:13]
self.nationality = mrz2[10:13].strip("<")
self.date_of_birth = mrz2[13:19]
self.calculate_check_digit(mrz2[13:19], mrz2[19], "Date of birth")
@ -845,7 +845,7 @@ class Passport(object):
if mrz2[-2] != "<":
self.calculate_check_digit(splitted_opt_field[1], mrz2[-2], "Optional data")
self.calculate_check_digit(mrz2[:-1], mrz2[-1], "Second line of machine readable zone")
self.calculate_check_digit(mrz2[0:10]+mrz2[13:20]+mrz2[21:43], mrz2[-1], "Second line of machine readable zone")
print self.type, self.issuer, self.name
print self.document_no, self.nationality, self.date_of_birth, self.sex, self.expiration_date, self.optional
@ -877,6 +877,3 @@ if __name__ == "__main__":
## biometric.store(basename= "biometric_testdg2_%02i" % index)
p = Passport([mrz1, mrz2])