delete used file
This commit is contained in:
Executable
+65
@@ -0,0 +1,65 @@
|
||||
import re
|
||||
|
||||
from mrz.generator.td3 import TD3CodeGenerator
|
||||
|
||||
|
||||
def encode(s: str) -> str:
|
||||
s = s.encode(encoding='gb2312').hex()
|
||||
res = []
|
||||
for c in s:
|
||||
res.append(chr(ord('a') + int(c, base=16)))
|
||||
return "".join(res).upper()
|
||||
|
||||
|
||||
def decode(s: str) -> str:
|
||||
t = []
|
||||
for c in s:
|
||||
t.append(format((ord(c) - ord('A')), 'x'))
|
||||
t = re.findall('.{1,2}', "".join(t))
|
||||
res = []
|
||||
for c in t:
|
||||
res.append(int("0x" + c, 16))
|
||||
return bytes(res).decode('gb2312')
|
||||
|
||||
|
||||
chinese_name = "鲁思思"
|
||||
first_name = "sisi"
|
||||
last_name = "lu"
|
||||
passport_number = "E96619397"
|
||||
birth_day = "981215"
|
||||
sex = "F"
|
||||
# sex = "M"
|
||||
expire_date = "290116"
|
||||
|
||||
encoded_chinese_name = encode(chinese_name)
|
||||
print(encoded_chinese_name)
|
||||
optional_data_length = 14 - len(encoded_chinese_name)
|
||||
for i in range(0, optional_data_length):
|
||||
encoded_chinese_name = encoded_chinese_name + "<"
|
||||
|
||||
# optinal_data = "MFMLMANK<<<<A9" #14位
|
||||
# nationality = "TWN"
|
||||
nationality = "CHN"
|
||||
if nationality == "TWN":
|
||||
optinal_data = "I100217437" # 14位
|
||||
document_prefix = "P"
|
||||
|
||||
else:
|
||||
optinal_data = encoded_chinese_name # 14位
|
||||
document_prefix = "PO"
|
||||
|
||||
|
||||
# first_name = "Lei"
|
||||
# last_name = "PAN"
|
||||
# passport_number = "G22611379"
|
||||
# birth_day = "841215"
|
||||
# sex = "M"
|
||||
# optinal_data = "19203301<<<<<<" #14位
|
||||
# expire_date = "170510"
|
||||
|
||||
code = TD3CodeGenerator(document_prefix, nationality, last_name, first_name, passport_number, nationality, birth_day,
|
||||
sex, expire_date,
|
||||
optinal_data)
|
||||
# code = TD3CodeGenerator("PO", "CHN", "PAN", "LEI", "E90600575", "CHN", "841215", "M", "270116", "MFMLMANK<<<<A9")
|
||||
|
||||
print(code)
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
from mrz.generator.td1 import TD1CodeGenerator
|
||||
|
||||
first_name = "Zhen"
|
||||
last_name = "XU"
|
||||
document_number = "E10805074"
|
||||
birth_day = "990620"
|
||||
sex = "F"
|
||||
# optinal_data = "MFMLMANK<<<<A9" #14位
|
||||
nationality = "CHN"
|
||||
country_code = "HUN"
|
||||
# optinal_data = "<E10805074" # 14位
|
||||
optinal_data = None
|
||||
document_prefix = "IR"
|
||||
expire_date = "240801"
|
||||
if optinal_data is not None:
|
||||
code = TD1CodeGenerator(document_prefix, country_code, document_number, birth_day, sex, expire_date, nationality,
|
||||
last_name, first_name, optional_data1=optinal_data)
|
||||
else:
|
||||
code = TD1CodeGenerator(document_prefix, country_code, document_number, birth_day, sex, expire_date, nationality,
|
||||
last_name, first_name)
|
||||
print(code)
|
||||
Reference in New Issue
Block a user