krus_aragon
Established Member
Wow, that's huge compared with the 20 characters I was once told!
A bit is just a 0 or a 1. You need to string seven or eight bits together following an encoding scheme (such as ASCII) in order to store characters. So 20 characters at 8 bits each would take up 160 bits.
20 characters wouldn't be enough to name the origin and destination stations, but the magnetic strip is read by a computer, which will be just as happy with numbers. 12 bits will store a number from 1-4096 (as mentioned above), so having given 24 bits to origin and destination stations, any ticket barrier can use a local database to know if that ticket is valid to start, break, or end a journey.
You could assign a 25th bit to show whether a journey has been started (to be set by the barrier at the origin station) and another to indicate whether it has been finished or not.
Dates for start and end of validity could be stored in as little as 12 bits each (depending on how far into the future you want dates to go), and then you can go on with other details you want to record. I seem to recall that a ticket can be issued for up to eight adults and eight children. That'd be another six bits (2 to the power of 3 is 8 adults). Then there's railcards, etc., and the magnetic strip still isn't half full...
(This is all deduced from principle, and not based on the actual specifications.)