Codes (Identification Numbers)

Coding is a method for conveying information efficiently and accurately; also, a group of symbols that represents information.

Examples of codes include: hieroglyphics, Greek alphabet, Roman numerals, Arabic numerals, music scores, Morse code, DNA, ASCII, cable television, ZIP codes, credit card numbers, Postnet, UPC, social security numbers, Soundex, ISBN, code 39.

Good codes self-check for errors!

Code Type Code Pattern
C = check digit
Verification Undetectable
Substitutions
Undetectable
Transpositions
Comments
Money Orders,
Traveler's Checks
XXXXXXXXXXC 1. Sum all digits
2. Divide by 9
3. Remainder is check digit
0 <--> 9 All  
Airline Tickets,
FedEx, UPS, Avis,
National
XXXXXXXXXXC 1. Divide ID by 7
2. Remainder is check digit
0 <--> 7
1 <--> 8
2 <--> 9
Can detect transpositions of adjacent pairs except for those at left ID# is normally too large to do calculations with hand-held calculator
UPC: Universal Product Code G MMMMM PPPPP C
G = goods type
M = manufacturer
P = product
1. Add digits in ODD positions
2. Multiply this sum by 3
3. Add digits in EVEN positions
4. Add results of steps 2 and 3
5. The last digit of the result must be ZERO to be valid
None Within odd positions and within even positions A type of bar code.
Detects 89% of common errors.
Assigned by the Uniform Code Council in Dayton, OH.
Goods type: 0 = grocery, 2 = random weight (meats & cheeses), 3 = drug, 4 = price reduced by manufacturer, 5 = cents off coupon
Each digit is scanned as seven modules, each module is light (0) or dark (1); the computer then coverts the modules into digits.
Digits used in the manufacturer's code use an odd number of 1s (dark modules); product digits have an even number of 1s (this is done so the computer can tell which direction the code is being scanned).
101 on each end are "guard" bars to let the computer know the width of a module; 01010 separates the manufacturer and product digits.

Binary UPC Codes (Conversion from modules to digits):

Manufacturer's Number Product Number
0 = 0001101 2 = 0010011 4 = 0100011 6 = 0101111 8 = 0110111 0 = 1110010 2 = 1101100 4 = 1011100 6 =1010000 8 = 1001000
1 = 0011001 3 = 0111101 5 = 0110001 7 = 0111011 9 = 0001011 1 = 1100110 3 = 1000010 5 = 1001110 7 = 1000100 9 = 1110100

Code Type Code Pattern
C = check digit
Verification Undetectable
Substitutions
Undetectable
Transpositions
Comments
Personal Checks |: FFFF BBBB C |: AAAAAAA"NNNN
F = Federal Reserve
B = bank
A = account
N = check number
1. Digits 1, 4, & 7 - multiply by 7
2. Digits 2, 5, & 8 - multiply by 3
3. Digits 3 & 6 - multiply by 9
4. Add all multiplications
5. Last digit of result is the check digit
None Almost none  
Codabar (all major credit cards) IBBBBAAAAAAAAAAC
I = Amex 3, Visa 4, MC 5, Discover 6
B = bank
A = account
1. Add digits in ODD positions
2. Multiply this sum by 2
3. Count digits in ODD positions that are greater than 4
4. Add digits in EVEN positions
5. Total results from steps 2 through 4
6. Last digit of final result must be ZERO to be valid
None Within even positions and within odd positions Detects 98% of common errors
ISBN (International Standard Book Number) L-PPPP-BBBB-C
L = predominant language of country where published
P = publisher
B = specific book
1. Multiply 1st digit by 10
2. Multiply 2nd digit by 9
3. Multiply 3rd digit by 8
4. Continue pattern through all digits
5. Add all multiplications
6. Divide total by 11
7. If valid ISBN then the remainder is zero
None None It is possible to get a check digit of 10. If this occurs, either the check digit is X or the book number is not used.
Code 39 (DOD, auto manufacturers, health industry, some auto companies, health industry) XXXXXXXXXXXXXXC 1. Convert any letters to values:
A<-->10, B<-->11,...,Z<-->35
2. Multiply 1st digit by 15
3. Multiply 2nd digit by 14
4. Multiply 3rd digit by 13
5. Continue pattern through all digits
6. Add all multiplications
7. Divide total by 36
8. If valid code, then the remainder is zero
None None A variation of this code adds the following characters: (hypen) -<-->36, (period) .<-->37, space<-->38, $<-->39, /<-->40, +<-->41, %<-->42.
Divide the total by 43 instead of 36.
In Vehicle Identification Numbers (VIN), the 10th symbol is the year model of the vehicle. This is only true in vehicles manufactured after 1980; 1980<-->A.
Code Type Code Pattern
C = check digit
Verification Comments
ZIP Codes NSSPP-DDGG
N = national area
S = sectional center (usually a large city)
P = local post office
D = delivery sector
G = group (houses on a block or group of post office boxes)
Cannot be verified; ZIP codes do not contain a check digit. National areas:
0 = New England including Puerto Rico and the Virgin Islands
1 = North Atlantic including New York
2 = Central Atlantic including Carolinas
3 = South Atlantic including Tennessee
4 = Heartland including Illinois
5 = North Central including Montana
6 = Central including Kansas
7 = South Central including Arkansas
8 = Rockies including Idaho
9 = Pacific coast including Alaska and Hawaii
Postnet : bar code for ZIP codes used by the Postal Service LNNNNNSSSSSsssss
PPPPPpppppDDDDDddddd
GGGGGgggggCCCCCL

Start with a long bar, L, then there are 10 groups of 5 long and short bars followed by a long bar, L. Long bars on the end are called the guard bars.

1. Convert to a sequence of 0s (for short bars) and 1s (for long), skipping the guard bars and writing in blocks of five.
2. Use the table (below) to convert blocks to digits:
1 = 000112 = 00101
3 = 001104 = 01001
5 = 010106 = 01100
7 = 100018 = 10010
9 = 101000 = 11000

3. Add all the digits
4. A valid code must end in zero.
1. Each block has 3 short and 2 long bars
2. Can detect, identify, and correct all single bar misprints.
3. Variation known as delivery-point bar code used by bulk mailers. This is the ZIP+4 code, then last two digits of street address, then check digit.
Code Type Code Pattern
C = check digit
Verification
Soundex (usually used to encode last names, Census bureau, Department of Health) S-XXX
S = first letter of word encoded
X = code digits
1. Delete all occurrences of h and w
2. Assign values to letters
a,e,i,o,u,y<-->0; b,f,p,v<-->1; c,g,j,k,q,s,x,z<-->2; d,t<-->3; l<-->4; m,n<-->5, r<-->6
3. If two or more letters with the same numerical value are adjacent, omit all but the first.
4. If the first digit corresponds to the value for the first letter of word (name), then delete it.
5. Delete all zeros (a, e, i, o, u, y).
6. XXX is the first three digits; add zeros if there are less than three digits remaining.

Assignment: Find as many different types of codes as you can. Identify the type of code and show that it is valid and/or explain the code. Turn in your examples, computations, and explanations on Wednesday, 26 May.