http://www.cl.cam.ac.uk/~rnc1/descrack/faq.html#Q2... 
Most banks use the "IBM Pin Derivation Method". The 16 digit account number on the front of your credit or debit card is taken as a hexadecimal string. This is then converted to a 64 bit block, which is encrypted using a special "PIN Derivation Key". The resulting ciphertext is converted back into hexadecimal, and all but the first four characters are discarded. Any occurrences of the letters A..F are converted to 0..5 using a simple substitution table. The result is your PIN number.
Account Number 5641326664532212
Encrypted with PIN derivation key F32C2F453ABD002A
Truncated F32C
Remapped 5322
Most banks let you change your PIN number. They do this by adding an offset to the original PIN, which marks the difference between old and new. These offsets are not securely stored, as without the root PIN, they are useless.