This code is generally used on Track2 of the magnetic card.
This is a 5-bit Binary Coded Decimal format. It uses a 16-character set, which uses 4 of the 5 available bits. The 5th bit is an ODD parity bit, which means there must be an odd number of 1’s in the 5-bit character..the parity bit will “force” the total to be odd. Also, the Least Significant Bits are read FIRST on the strip.
The sum of the 1’s in each case is odd, thanks to the parity bit. If the reader system adds the 5 bits and gets an EVEN number, it flags the read as an ERROR, and typicaly requests the user to scan the card again.
- Remember that b1 (bit #1) is the LSB (least significant bit)!
- The LSB is read FIRST!
- Hexadecimal conversions of the Data Bits are given in parenthesis (xH).
--Data Bits-- Parity b1 b2 b3 b4 b5 Character Function 0 0 0 0 1 0 (0H) Data 1 0 0 0 0 1 (1H) " 0 1 0 0 0 2 (2H) " 1 1 0 0 1 3 (3H) " 0 0 1 0 0 4 (4H) " 1 0 1 0 1 5 (5H) " 0 1 1 0 1 6 (6H) " 1 1 1 0 0 7 (7H) " 0 0 0 1 0 8 (8H) " 1 0 0 1 1 9 (9H) " 0 1 0 1 1 : (AH) Control 1 1 0 1 0 ; (BH) Start Sentinel 0 0 1 1 1 < (CH) Control 1 0 1 1 0 = (DH) Field Separator 0 1 1 1 0 > (EH) Control 1 1 1 1 1 ? (FH) End Sentinel ***** 16 Character 5-bit Set ***** 10 Numeric Data Characters 3 Framing/Field Characters 3 Control Characters
The magstripe begins with a string of Zero bit-cells to permit the self-clocking feature of biphase to “sync” and begin decoding. A “Start Sentinel” character then tells the reformatting process where to start grouping the
decoded bitstream into groups of 5 bits each. At the end of the data, an “End Sentinel” is encountered, which is followed by an “Longitudinal Redundancy Check (LRC) character.
Error Detection
Two techniques of error detection are used.
Parity
A parity bit is used for each character. The parity bit is defined so that the sum of the ‘one’ bits in the character, including the parity bit, shall be odd.
Longitudinal Redundancy Check (LRC)
The LRC shall appear for each data track. The LRC is calculated using the following method;
The value of each bit in the LRC, excluding the parity bit, is defined such that the total number of ‘one’ bits encoded in the corresponding bit location of all characters in the data track, including the start sentinel, data, end sentinel and LRC character shall be even.
The LRC character’s parity bit is a parity bit for the LRC only, and is encoded as in the section ‘Parity’ shown above.
The START SENTINEL, END SENTINEL, and LRC are collectively called “Framing Characters”, and are discarded at the end of the reformatting process.