Ever wondered how machine readable passports work and how do they encode and decode data while swiping?  Do you notice at passport control, officers swipe the passport containing your data? When you closely observe your travel document visa or passport, you might notice something on the bottom. It is called Machine Readable Zone (MRZ) and it will have a data something stuffed in 2 lines like this. It is 44 chars wide fixed format.

This algorithm is called ISO/IEC 7501-1:1997 for machine readable documents.  You can find more information here: http://www.highprogrammer.com/alan/numbers/mrp.html

PPUSAMILLER<<JOHN<<<<<<<<<<<<<<<<<<<<<<<<<<<
J9280202<6USA8105118M44111012920993902<<<<16

Of course, when swiped the same data is read or decoded into the system, like this.

Sub-type: P
Given name(s): JOHN
Surname(s): MILLER
Date of birth: 
   Year: 1981
   Month: 05
   Day: 11
Sex: M
Issuer: USA
Passport expiration: 
   Year: 2044
   Month: 11
   Day: 10
Passport number: J9280202
Personal number: 2920993902
Nationality: USA

There is a useful tool to encode and decode machine readable data: http://www.highprogrammer.com/cgi-bin/uniqueid/mrzp

I have always been fascinated by the encoders and decoders in travel documents and always wondered how they worked.