
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
fastmrz
Advanced tools
FastMRZ is an open-source Python package that extracts the Machine Readable Zone (MRZ) from passports and other documents. FastMRZ accepts various input formats such as Image, Base64 string, MRZ string, or NumPy array.
Features • Built With • Prerequisites • Installation • Example • Wiki • ToDo • Contributing
PATH variable with the executable and ensure that tesseract can be reached from the command line.Install fastmrz
pip install fastmrz
This can be done through conda too if you prefer.
conda create -n fastmrz tesseract -c conda-forge
conda activate fastmrz
Copy the mrz.traineddata file from the tessdata folder of the repository into the tessdata folder of the Tesseract installation on YOUR MACHINE
from fastmrz import FastMRZ
import json
fast_mrz = FastMRZ()
# Pass file path of installed Tesseract OCR, incase if not added to PATH variable
# fast_mrz = FastMRZ(tesseract_path=r'/opt/homebrew/Cellar/tesseract/5.3.4_1/bin/tesseract') # Default path in Mac
# fast_mrz = FastMRZ(tesseract_path=r'C:\\Program Files\\Tesseract-OCR\\tesseract.exe') # Default path in Windows
passport_mrz = fast_mrz.get_details("../data/passport_uk.jpg", include_checkdigit=False)
print("JSON:")
print(json.dumps(passport_mrz, indent=4))
print("\n")
passport_mrz = fast_mrz.get_details("../data/passport_uk.jpg", ignore_parse=True)
print("TEXT:")
print(passport_mrz)
OUTPUT:
JSON:
{
"mrz_type": "TD3",
"document_code": "P",
"issuer_code": "GBR",
"surname": "PUDARSAN",
"given_name": "HENERT",
"document_number": "707797979",
"document_number_checkdigit": "2",
"nationality_code": "GBR",
"birth_date": "1995-05-20",
"sex": "M",
"expiry_date": "2017-04-22",
"optional_data": "",
"mrz_text": "P<GBRPUDARSAN<<HENERT<<<<<<<<<<<<<<<<<<<<<<<\n7077979792GBR9505209M1704224<<<<<<<<<<<<<<00",
"status": "SUCCESS"
}
TEXT:
P<GBRPUDARSAN<<HENERT<<<<<<<<<<<<<<<<<<<<<<<
7077979792GBR9505209M1704224<<<<<<<<<<<<<<00
The standard for MRZ code is strictly regulated and has to comply with Doc 9303. Machine Readable Travel Documents published by the International Civil Aviation Organization.
There are currently several types of ICAO standard machine-readable zones, which vary in the number of lines and characters in each line:
Now, based on the example of a national passport, let us take a closer look at the MRZ composition.


Contributions are welcome! Here's how you can help:
git checkout -b feature/amazing-feature)git commit -m 'feat: add amazing feature')git push origin feature/amazing-feature)Distributed under the AGPL-3.0 License. See LICENSE for more information.
Give a ⭐️ if this project helped you!
We’d love to know who’s using fastmrz! If your company or project uses this package, feel free to share your story. You can:
Thank you for supporting fastmrz! 🤟
FAQs
Extracts the Machine Readable Zone (MRZ) data from document images
We found that fastmrz demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.