Skip to content

A Rust parser for the machine-readable zone (MRZ) of machine-readable travel documents (MRTD) as defined by ICAO Document 9303.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

asmarques/mrtd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mrtd

Crate Documentation Build Status

A Rust parser for the machine-readable zone (MRZ) of machine-readable travel documents (MRTD) as defined by ICAO Document 9303.

Supported travel documents:

  • Passport
  • Identity Card

Example

use mrtd::{parse, Document};

fn main() {
    let passport_mrz = "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<\
        L898902C36UTO7408122X1204159ZE184226B<<<<<10";
    if let Document::Passport(passport) = parse(passport_mrz).unwrap() {
        assert_eq!(passport.passport_number, "L898902C3");
        println!("{:?}", passport);
    }

    let id_card_mrz = "C<ITACA00000AA4<<<<<<<<<<<<<<<\
        6412308F2212304ITA<<<<<<<<<<<0\
        ROSSI<<BIANCA<<<<<<<<<<<<<<<<<";
    if let Document::IdentityCard(identity_card) = parse(id_card_mrz).unwrap() {
        assert_eq!(identity_card.document_number, "CA00000AA");
        println!("{:?}", identity_card);
    };
}

About

A Rust parser for the machine-readable zone (MRZ) of machine-readable travel documents (MRTD) as defined by ICAO Document 9303.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages