Routing number
An ABA routing number names a US bank on a cheque or a transfer. It has nine digits, and the ninth is a check digit.
What a routing number is
Four digits of Federal Reserve routing symbol, four digits of institution identifier, and a check digit. The first two digits say what kind of number it is: 01 to 12 for banks in the twelve Federal Reserve districts, 21 to 32 for savings institutions, 61 to 72 for electronic transactions and 80 for traveller’s cheques. Most of the other series are reserved for future use.
The check digit
Multiply the nine digits by 3, 7, 1, 3, 7, 1, 3, 7, 1 and add up the products. The number is correct when the total is a multiple of 10.
The registrar’s policy describes the parts of the number and leaves the arithmetic to a paid publication. Every one of the 67 routing numbers of the Federal Reserve Banks and the Federal Home Loan Banks printed in Regulation CC passes this check.
Valid routing numbers for your tests
$ qadg quick aba --count 5 --seed example 119679005 108399260 091739212 091005645 095820253
Every number starts with 01 to 12, a series of banks, because no series is kept free for testing: the registrar says its Board will decide how the series reserved for future use are used. A generated routing number can match a real bank’s, so keep it in test systems.
What your application should do with a broken one
Refuse a number whose check digit does not match. The damage can also move a number into a series reserved for future use, with a correct check digit. No bank holds such a number today, so an application that checks routing numbers against the Federal Reserve’s directory should refuse it. The manifest marks this answer as depending on your application, because many applications do not hold the directory.
Broken ones for your tests
The recipe below makes 100 values and asks for damage in 20% of the rows. Download it and run it as it is, then change the count or the share to fit your tests.
The recipe
# ABA routing numbers for testing, with one broken value asked for in about a
# fifth of the rows.
#
# A routing number can match a real bank's, so keep the file in test systems.
# The damage changes a digit, swaps two, or moves a number into a series
# reserved for future use, and the manifest says your application should reject
# each one. It also lists the damage this build could not carry out, with the
# reason.
#
# qadg generate routing-number.yaml
#
# writes bank.csv, expectation-manifest.json and run-note.json. The same seed
# breaks the same values on every machine.
version: "0.1"
seed: "routing-number"
locale: en-US
entities:
bank:
count: 100
fields:
routing_number: { generator: aba }
policy:
layers: [L3]
rows: 20%
per_row: exactly_one
output:
format: csv
Run it
Save the recipe, then run this in the same folder. This is what the program printed for it.
$ qadg generate routing-number.yaml bank: 100 rows, 1 column 1 table, 100 rows written 19 defects ordered, 7 applied, manifest in expectation-manifest.json 12 defects could not be applied, and the manifest carries the reason for each one 1 because the values in those rows did not suit them 11 because this build has no implementation of them yet
What it damaged
The recipe ordered 19 defects, and this build applied the 7 below. The other 12 are in the manifest as not applied, each with its reason, and the run above counts them by reason.
L3.checksum.off_by_onerejectbank 8, column routing_number
034555408 → 034555409
L3.range.unassigned~ rejectbank 37, column routing_number
074423037 → 134423032
L3.checksum.off_by_onerejectbank 44, column routing_number
062640686 → 062640687
L3.checksum.transposed_digitsrejectbank 55, column routing_number
117959620 → 119759620
L3.range.unassigned~ rejectbank 83, column routing_number
125464152 → 135464155
L3.checksum.off_by_onerejectbank 89, column routing_number
069178656 → 069178657
L3.checksum.transposed_digitsrejectbank 95, column routing_number
017888639 → 017886839
Sources
- ABA Routing Number Policy & Procedures, version 9/20, from LexisNexis Risk Solutions as the official ABA registrar, section IV.
- 12 CFR 229 (Regulation CC), appendix A.