------------------------
(Test String) todo list
------------------------
* float
* date
(see homepage: http://www.cs.chalmers.se/~bringert/darcs/parsedate)
* credit card numbers
(see below)
(see http://haskell.org/haskellwiki/Haskell_Quiz/Credit_Cards)
* bank routing numbers (on checks)
(see below)
* VIN numbers
* ????
----------------------
CREDIT CARDS GENERAL
-----------------------
+============+=============+===============+
| Card Type | Begins With | Number Length |
+============+=============+===============+
| AMEX | 34 or 37 | 15 |
+------------+-------------+---------------+
| Discover | 6011 | 16 |
+------------+-------------+---------------+
| MasterCard | 51-55 | 16 |
+------------+-------------+---------------+
| Visa | 4 | 13 or 16 |
+------------+-------------+---------------+
Luhn algorithm:
(1) Starting with the next to last digit and continuing with
every other digit going back to the beginning of the card,
double the digit.
(2) Sum all doubled and untouched digits in the number.
(3) If that total is a multiple of 10, the number is valid.
So,
4408 0412 3456 7893
Step 1: 8 4 0 8 0 4 2 2 6 4 10 6 14 8 18 3
Step 2: 8+4+0+8+0+4+2+2+6+4+1+0+6+1+4+8+1+8+3 = 70
Step 3: 70 % 10 == 0
4417 1234 5678 9112
Step 1: 8 4 2 7 2 2 6 4 10 6 14 8 18 1 2 2
Step 2: 8+4+2+7+2+2+6+4+1+0+6+1+4+8+1+8+1+2+2 = 69
Step 3: 69 % 10 != 0
----------------------
CREDIT CARD TYPES
-----------------------
Card Type Prefix(es) Active Length Validation Symbol for coverage chart
American Express 34, 37[1] Yes 15[2] Luhn algorithm AmEx
Bankcard[3] 5610, 560221-560225 No 16 Luhn algorithm BC
China Union Pay 622 (622126-622925) Yes 16,17,18,19 unknown CUP
Diners Club Carte Blanche 300-305 Yes 14 Luhn algorithm DC-CB
Diners Club enRoute 2014, 2149 No 15 no validation DC-eR
Diners Club International[4] 36 Yes 14 Luhn algorithm DC-Int
Diners Club US & Canada[5] 55 Yes 16 Luhn algorithm DC-UC
Discover Card[6] 6011, 65 Yes 16 Luhn algorithm Disc
JCB[citation needed] 35 Yes 16 Luhn algorithm JCB
JCB[citation needed] 1800,2131 Yes 15 Luhn algorithm JCB
Laser (debit card)[citation needed] 6304, 6706, 6771, 6709 Yes 16-19 Luhn algorithm / unknown? Lasr
Maestro (debit card) 5020,5038,6304,6759,6761 Yes 16,18 Luhn algorithm Maes
MasterCard 51-55 Yes 16 Luhn algorithm MC
Solo (debit card) 6334 Yes 16,18,19 Luhn algorithm Solo
Switch (debit card) 4903,4905,4911,4936,564182,633110,6333,6759 Yes 16,18,19 Luhn algorithm Swch
Visa 4[1] Yes 13,16[7] Luhn algorithm Visa
Visa Electron 417500,4917,4913,4508,4844 Yes 16 Luhn algorithm Visa
-----------------------------
CHECK ROUTING NUMBERS
-----------------------------
The ABA transit number generally appears in the
upper right part of a check near the date. It looks
like a fraction, with a numerator and a denominator.
The denominator is identical to the first four digits
of the routing number. The numerator consists of two
parts. The prefix is a one to three digit code indicating
the region where the bank is located. The numbers 1 to 49
are cities. They were assigned by size of the cities in
1910. The numbers 50 to 99 are states. They were assigned
in a rough spatial geographic order. They are used for
banks located outside one of the 49 numbered cities.
There might be a fourth element to the ABA number, a
branch number, at either the end of the transit number
or to the right of it.
The routing number consists of 9 digits:
XXXXYYYYC
where XXXX is Federal Reserve Routing Symbol
YYYY is ABA Institution Identifier
C is the Check Digit
The first two digits of the nine digit ABA number must be in
the ranges 00 through 12, 21 through 32, 61 through 72, or 80.
The digits are assigned as follows:
* 00 is used by the United States Government
* 01 through 12 are the "normal" routing numbers
* 21 through 32 were assigned only to thrift institutions
(e.g. credit unions and savings banks) through 1985;
currently are still used by the thrift institutions,
or their successors
* 61 through 72 are used for electronic transactions
* 80 is used for traveler's cheques
The first two digits correspond to the 12 Federal
Reserve Banks as follows:
--------------------------------------------------------
Primary Thrift Electronic Federal Reserve Bank
01 21 61 Boston
02 22 62 New York
03 23 63 Philadelphia
04 24 64 Cleveland
05 25 65 Richmond
06 26 66 Atlanta
07 27 67 Chicago
08 28 68 St. Louis
09 29 69 Minneapolis
10 30 70 Kansas City
11 31 71 Dallas
12 32 72 San Francisco
---------------------------------------------------------
The number must pass a checksum test using a position-weighted
sum of each of the digits.
* The following condition must hold:
(3(d1+d4+d7)+7(d2+d5+d8)+1(d3+d6+d9)) mod 10 = 0.
As an example, consider 111000025 (which is a valid routing number
of Bank of America in Texas). Applying the formula, we get:
(3(1 + 0 + 0) + 7(1 + 0 + 2) + 1(1 + 0 + 5)) mod 10 = 0.
The following formula can be used to generate the 9th digit in
the checksum:
(10−(3(d1+d4+d7)+7(d2+d5+d8)+1(d3+d6)) mod 10) mod 10 = d9
Following the above example for the Texas Bank of America
routing number 111000025,
(10−(3(1+0+0)+7(1+0+2)+1(1+0)) mod 10) mod 10 = 5.