180 likes | 371 Vues
The Digital Revolution. Chapters 16 & 17 Sarah Cameron 18 March 2010. Outline. Review of Modular Arithmetic Identification Numbers ZIP Codes Bar Codes Binary Codes Encryption. Review of Modular Arithmetic. a mod n = the remainder when a is divided by n Examples: 3 mod 2 = 1
E N D
The Digital Revolution Chapters 16 & 17 Sarah Cameron 18 March 2010
Outline • Review of Modular Arithmetic • Identification Numbers • ZIP Codes • Bar Codes • Binary Codes • Encryption
Review of Modular Arithmetic • a mod n = the remainder when a is divided by n • Examples: • 3 mod 2 = 1 • 37 mod 10 = 7
Identification Numbers • Identification Numbers: • Unambiguously identify the person or thing with which it is associated • Should be “self-checking”
The ZIP Code Five Digits: ABCDE A: Represents one of 10 geographic areas in the US, normally a grouping of states BC: These two digits in combination with the first, identify a central mail-distribution point known as a sectional center. DE: The last two digits indicate the town or local post office, the order is often alphabetical for towns within a delivery area
The ZIP + 4 code 4 code: FGHJ FG: Represent a delivery sector. HJ: Narrow the area further based on the needs of the delivery sector. Bonus Trivia: Using the ZIP + 4 code makes you eligible for cheaper bulk rates.
Binary Codes Binary Code: any system for representing data with only two symbols Bar Code: a series of dark and light spaces that represent characters
UPC Bar Code Has been used since 1973. 12 Digit number: KLMNOPQRSTUV K: This digit identifies the kind of product. LMNOP: These digits identify the manufacturer. QRSTU: These digits are assigned by the manufacturer to identify the product. V: The final digit is the check digit.
Check Digits • Check Digits • Used for error detection and correction • Can be the last digit in an ID number or a binary code. • Often for ID numbers: • Sum the individuals digits and mod by the check digit
Encoding with Parity Check Sums • Take binary string a1a2a3a4 and append three check digits c1c2c3 so that any single error in any of the seven positions can be corrected • Choose 3 different sums: • c1 :a1 + a2 + a3 • c2 :a1 + a3 + a4 • c3 :a2 + a3 + a4 • If the value of the check is even, the check digit should be zero. • If the value of the check sum is odd, the check digit should be one. • Using this method you are able to produce a list of all possible a1a2a3a4c1c2c3 combinations.
Decoding Parity-Check Sums • Nearest-Neighbor Decoding • This method decodes a received message as the code word that agrees with the message in the most positions • Distance Between Two Strings (of equal length) • The number of positions in which the strings differ. • Example: • Real Message: 1000110 • Received as: 1010110 • The distance between the real message and the received message is one. • If there are two possible translations for an erroneous message, it is not decoded.
Accuracy • Binary Linear Code • Consists of words composed of 0’s and 1’s obtained from all possible messages of a given length by using parity-check sums to append check digits to the messages. These words are called code words. • Weight of a Binary Code • Is the minimum number of 1’s that occur among all nonzero words of that code. • Accuracy: • If the weight of a binary code is odd, the code will correct any (t-1)/2 or fewer errors. • If the weight of a binary code is even, the code will correct any (t-2)/2 or fewer errors. • If you simply want to detect errors, the code will detect t-1 errors
Cryptography • Encryption • The process of disguising data • Cryptology • The study of methods to make and break secret codes • Data Compression • The process of encoding data so that the most frequently occurring data are represented by the fewest symbols
How Often Do Different Letters Occur in the English Language
Soundex Coding System • Delete all occurrences of h and w. • Assign numbers to the remaining letters as follows: • 0: A, E, I, O, U • 1: B, F, P, V • 2: C, G, J, K, Q, S, X, Z • 3: D, T • 4: L • 5: M, N • 6: R • If two or more letters with the same numeric value are adjacent, omit all but the first. • Delete the first character of the original name, if still present. • Delete all occurrences of A, E, I, O, U, and Y. • Retain only the first three digits corresponding to the remaining letters. • Append trailing 0’s if fewer than three letters remain. • Precede the digits with the first letter of the name.
Caesar Cipher • Used by Julius Caesar to send messages to his troops. • Decode “DWWDFN DW GDZQ” • The encoded message: “ATTACK AT DAWN”
Vigenére Cipher • Choose a key word, which can be anything. • Add the digit position of the original letter to the digit position of the key word letter. • Mod that number by 26 = digit position of the coded letter. • Repeat the key word for as many characters as you need. • Answer: TA PAPU;19, 0, 15, 0, 15, 20
Disscussion and HW • Questions? • Applications? • Homework: (7th Edition) • Chapter 16: #74 • Chapter 17: #11