Encoding and Encrypting Information

Similar documents
is evenly divisibly by 10. What is the check digit for the mild RO TEL?

Math for Liberal Studies

Check off these skills when you feel that you have mastered them.

The UPC codes use a check digit to minimize scanning errors. A check digit is a digit included in a code to help detect errors.

b) Describe a procedure visitors should follow to find a free parking space, when the space they are assigned is occupied.

T H E I N T E R A C T I V E S H E L L

Section 1.1 Patterns in Division

(c) Finally apply critical path scheduling using two processors to the order requirement

Adding and Subtracting with Decimals

Algebra2go: Working with Fractions and Mixed Numbers

CONNECTING A BAR-CODE WAND TO THE MP3 CONTROLLER/PLAYER

Example 2: Simplify each of the following. Round your answer to the nearest hundredth. a

From last time to this time

Introduction to Scratch Programming v1.4 (Second Ed) Lesson 6 Calculator

Properties and Definitions

Week 3 More Formatted Input/Output; Arithmetic and Assignment Operators

Cryptography Worksheet

0001 Understand the structure of numeration systems and multiple representations of numbers. Example: Factor 30 into prime factors.

COP 3275: Chapter 04. Jonathan C.L. Liu, Ph.D. CISE Department University of Florida, USA

The School District of Palm Beach County Fourth Grade Mathematics Scope st Trimester

Lesson 1: Arithmetic Review

The RAM Computation Model

in this web service Cambridge University Press

Modular Arithmetic. Marizza Bailey. December 14, 2015

Fractions. There are several terms that are commonly used when working with fractions.

Compression; Error detection & correction

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #23 Loops: Precedence of Operators

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Name:... Class:... Due date:... Calculating, estimating and approximating. Use a calculator to evaluate the following four questions.

Errors. Chapter Extension of System Model

Review of Number Systems

NUMBER SENSE AND OPERATIONS. Competency 0001 Understand the structure of numeration systems and multiple representations of numbers.

Compression; Error detection & correction

Accuplacer Arithmetic Study Guide

Divisibility Rules and Their Explanations

NEXT-GENERATION Arithmetic

Chapter 8 Patterns. Examples: a, b, c,, x, y, z

Using Algebraic Expressions to Analyze

Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997

What is a Fraction? Fractions. One Way To Remember Numerator = North / 16. Example. What Fraction is Shaded? 9/16/16. Fraction = Part of a Whole

Hash Tables (Cont'd) Carlos Moreno uwaterloo.ca EIT

Chapter 1 Operations With Numbers

Condition Controlled Loops. Introduction to Programming - Python

OA: Operations and Algebraic Thinking

Lab 7 1 Due Thu., 6 Apr. 2017

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

The Gray Code. Script

Burnley Brow Year 5 Mathematics Overview

Excerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.

9 abcd = dcba b + 90c = c + 10b b = 10c.

Division. Reverse Box Method

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently.

Unit 3. Operators. School of Science and Technology INTRODUCTION

umber Systems bit nibble byte word binary decimal

08. First and second degree equations

PROBLEM OF ERRORS IN CALCULATION : A NEW CONCEPT OF DECIMAL

Decimals Outcomes. Represent Q Using Decomposition

CS/MA 109 Fall Wayne Snyder Computer Science Department Boston University

Unit 4: Multiplication

Elementary Number Theory. Kenneth H. Rosen Sixth Edition

CHAPTER 2 - DIGITAL DATA REPRESENTATION AND NUMBERING SYSTEMS

Senior Math Circles Cryptography and Number Theory Week 1

Homework #3 CS2255 Fall 2012

Using Formulas and Functions

More complicated than addition. Let's look at 3 versions based on grade school algorithm (multiplicand) More time and more area

What we will do today Explain and look at examples of. Programs that examine data. Data types. Topic 4. variables. expressions. assignment statements

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

Elfring Fonts LaserJet Bar Codes & More

Mini-Lesson 1. Section 1.1: Order of Operations PEMDAS

CONDITION CONTROLLED LOOPS. Introduction to Programming - Python

Document Capture for Microsoft Dynamics NAV

SYNOPSIS This pracnique explores an Ada program to apply Luhn s algorithm to verify credit card information.

Multiplying and Dividing by Powers of 10

Accuplacer Arithmetic Review

Computers in Engineering COMP 208 Repetition and Storage Michael A. Hawker. Repetition. A Table of Values 9/20/2007

3.1 Using Exponents to Describe Numbers

Radicals and Fractional Exponents

Lesson 9: Decimal Expansions of Fractions, Part 1

Math 202 Test Problem Solving, Sets, and Whole Numbers 19 September, 2008

Problem Set 4: Streams and Lazy Evaluation

Readerware 3.0 (Video) Revision 27

Escher s Tessellations: The Symmetry of Wallpaper Patterns II. Symmetry II

Combinatorics Prof. Dr. L. Sunil Chandran Department of Computer Science and Automation Indian Institute of Science, Bangalore

Binary Representation. Jerry Cain CS 106AJ October 29, 2018 slides courtesy of Eric Roberts

HOW TO DIVIDE: MCC6.NS.2 Fluently divide multi-digit numbers using the standard algorithm. WORD DEFINITION IN YOUR WORDS EXAMPLE

2. MACHINE REPRESENTATION OF TYPICAL ARITHMETIC DATA FORMATS (NATURAL AND INTEGER NUMBERS).

Bits, Words, and Integers

Bits and Bytes. Here is a sort of glossary of computer buzzwords you will encounter in computer use:

Describe the two most important ways in which subspaces of F D arise. (These ways were given as the motivation for looking at subspaces.

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM

Math Glossary Numbers and Arithmetic

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013

Chapter 1: Number and Operations

Course Learning Outcomes for Unit I. Reading Assignment. Unit Lesson. UNIT I STUDY GUIDE Number Theory and the Real Number System

Modular Arithmetic. is just the set of remainders we can get when we divide integers by n

Topic 3: Fractions. Topic 1 Integers. Topic 2 Decimals. Topic 3 Fractions. Topic 4 Ratios. Topic 5 Percentages. Topic 6 Algebra

Rational Numbers CHAPTER Introduction

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

CHAPTER 6 Algorithms

Transcription:

Encoding and Encrypting Information

Information is often encoded numerically. By using some mathematics to encode information in an appropriate way, we can overcome problems encountered in dealing with the information. Different situations have different problems. We will consider three different ways to encode information to overcome three different types of problems. Each type we will introduce with one type of situation. 2

1. How can one give a code (such as a bar code) to a grocery store item in such a way to eliminate, or minimize, the chance that the item s price is registered correctly? You want to make sure the item is not mistaken for another. 2. How can one encode music or video on a cd or dvd in such a way that small imperfections (such as scratches) do not result in a loss of data? 3. How can you encrypt data, such as credit cards, so that you can transmit the data and have the intended recipient recover the data, but anybody else cannot recover it? 3

Identification Numbers Today we will talk about the first of the three situations described above. We will focus on two examples, UPC s and ISBN s. UPC stands for universal product code and ISBN stands for international standard book number. 4

The UPC Commercial products, such as grocery store items, are identified with a universal product code. This 12 digit numerical code uniquely identifies an item. It appears on the item both as a number and as a bar code. 5

The first string of digits (after the first) identify the manufacturer, and the second string of digits identify the item. The last digit is the one we will focus on. It is called the check digit. Its purpose is to detect errors. We shall see that if one single digit in the UPC is misread, then the resulting sequence will be determined to be invalid. 6

To see if a 12 digit sequence of digits is a valid UPC perform the following computation: multiply the first, third, fifth,..., digits by 3, and the others by 1. Add up the resulting numbers. If the sum is evenly divisible by 10, then the sequence is a valid UPC. For example, consider the sequence 7 18908 14447 3. weights digits 3 1 3 1 3 1 3 1 3 1 3 1 7 1 8 9 0 8 1 4 4 4 7 3 Sum product 21 1 24 9 0 8 3 4 12 4 21 3 110 7

The sum, 110, is evenly divisible by 10 since its last (right-most) digit is a 0. This shows that the sequence is a valid UPC. When an item is scanned, the scanner performs this computation. If the sequence is determined to be valid, then the item s price is retrieved from the store s computer. 8

How is the check digit determined? When a manufacturer produces an item and assigns a UPC, the first chunk of the sequence is the code for the manufacturer. They then select the second chunk to identify the item. Finally, they have to determine the check digit. How do they do this? We will see how through an example. 9

Suppose 0 25192 59452? is to be a UPC. What should be the check digit? We repeat the calculation to check for validity. weights digits 3 1 3 1 3 1 3 1 3 1 3 1 0 2 5 1 9 2 5 9 4 5 2? sum 0 2 15 1 27 2 15 9 12 5 6? 94 +? 10

This sum needs to be divisible by 10, and? must be a digit. The only digit that works is 6; the sum is then 100. So, the check digit is 6, and the full UPC is 0 25192 59452 6. Another way to find the check digit is to take the sum of 94, divide by 10. 10 goes into 94 nine times with 4 left over. Subtract the left over from 10 to get the check digit The numbers 3 and 1 used in the calculation are called weights. We shall see other weights in other identification number schemes. 11

To Find the Check Digit for a UPC To summarize, to find the check digit for a UPC, take the first part of the number, multiply each digit by the corresponding weight number (3 or 1), add up all the terms. Either divide the result by 10, and subtract the remainder from 10 to get the check digit. Alternatively, find the digit (0 through 9) which when added to the sum results in a number evenly divisible by 10. There is a unique digit which will make the calculation work above. 12

Question 1. Is 0 85391 77372 6 a valid UPC? 2. If 0 12569 50162 x is to be a valid UPC, what should be the value of x? 13

Answers 1. Is 0 85391 77372 6 a valid UPC? 3 1 3 1 3 1 3 1 3 1 3 1 Sum 0 8 5 3 9 1 7 7 3 7 2 6 0 8 15 3 27 1 21 7 9 7 6 6 110 The sum is evenly divisible by 10, so it is valid. 14

2. If 0 12569 50162 x is to be a valid UPC, what should be the value of x? 3 1 3 1 3 1 3 1 3 1 3 1 0 1 2 5 6 9 5 0 1 6 2 x Sum 0 1 6 5 18 9 15 0 3 6 6 x 69 + x x must then be 1 in order for the sum to be divisible by 10. The UPC is then 0 12569 50162 1. 15

The purpose of the check digit is to detect an error in one of the digits. If a UPC is read and any single digit is read incorrectly, then the resulting sequence will not be valid. For example, if 7 18908 14447 3 is read as 7 19908 14447 3 by misreading the third digit as 9 rather than 8, then when one performs the calculation, one gets weights digits 3 1 3 1 3 1 3 1 3 1 3 1 7 1 9 9 0 8 1 4 4 4 7 3 Sum 21 1 27 9 0 8 3 4 12 4 21 3 113 the resulting sum is not evenly divisible by 10, so the sequence is not valid. 16

A similar result will occur if any of the digits is changed. However, this scheme does not always detect multiple errors. For example, if 7 18908 14447 3 is read as 7 19608 14447 3, then the resulting calculation yields weights digits 3 1 3 1 3 1 3 1 3 1 3 1 7 1 9 6 0 8 1 4 4 4 7 3 Sum 21 4 27 6 0 8 3 4 12 4 21 3 110 and the sequence would be considered to be a valid UPC. This sort of scheme is then useful only when it is very unlikely to make multiple errors. 17

The ISBN An ISBN, or international standard book number, is a sequence of digits designed to uniquely identify a book. There are two types, ISBN-10 and ISBN-13. The former is being replaced by ISBN-13. The 10 and 13 refer to how many digits are used to represent a book. 18

ISBN-10 An example of an ISBN-10 is 0-387-94753-1. The first digit refers to the language of the book (0 = English). The second block refers to the publisher, the third block to the book itself, and the last digit is the check digit. Each book is then encoded with a 10 digit sequence. The purpose of the check digit is the same as for the UPC; to detect any error in a single digit of the ISBN. 19

To verify if a sequence is a valid ISBN, we perform the following calculation, which we illustrate with the ISBN 0-387-94753-1 10 9 8 7 6 5 4 3 2 1 0 3 8 7 9 4 7 5 3 1 Sum 0 27 64 49 54 20 28 15 6 1 264 If the sum is evenly divisible by 11, then the sequence is valid. Since 264 / 11 = 24, a whole number, the sequence is indeed valid. In other words, you multiply the first digit by 10, the second digit by 9, the third by 8, and so on, and then add all terms. The sequence is valid if the sum is evenly divisible by 11. 20

Use of the check digit allows us to detect single errors in an ISBN. For example, if we take the ISBN 0-387-94753-1 and change the 8th digit from 5 to 6, obtaining 0-387-94763-1, and perform the calculation to check validity, we get 10 9 8 7 6 5 4 3 2 1 0 3 8 7 9 4 7 6 3 1 Sum 0 27 64 49 54 20 28 18 6 1 267 Dividing 267 by 11 gives 24.27, not a whole number. So, 0-387-94763-1 is not a valid ISBN. 21

Finding the check digit for an ISBN is similar to that of a UPC. However, there is one difference that using 11, rather than 10, forces. For example, suppose that 0-14-010867 is to be the first part of an ISBN. What is the check digit? We compute weights digits 10 9 8 7 6 5 4 3 2 1 0 1 4 0 1 0 8 6 7? Sum 0 9 32 0 6 0 32 18 14? 111 +? If we divide 111 by 11, we see that 11 goes into 111 ten times with a remainder of 1. If we subtract the remainder from 11, we will get the check digit. However, this gives 10. To handle this case, the check digit is written as X. So, the full ISBN is 0-14-010867-X. 22

The somewhat more complicated scheme for the ISBN, which is not difficult for a computer to perform, does more than the UPC. Besides detecting single errors, it will also detect transposition errors. These are errors in which two digits are interchanged. For example, given the ISBN 0-387-94753-1, if we interchange the 5th and 6th digits, we will get 0-387-49753-1. If we perform the check to see if this is valid, we get 10 9 8 7 6 5 4 3 2 1 0 3 8 7 4 9 7 5 3 1 Sum 0 27 64 49 24 45 28 15 6 1 259 and since 259 / 11 = 23.54 is not a whole number, the sequence is not valid. 23

ISBN-13 Since 2007, books have given given a 13 digit ISBN, which is slowly replacing the 10 digit ISBN. For example, the 13 digit ISBN for the book whose 10 digit ISBN is 0-387-94753-1 is 978-0387947532. This scheme is very much like the UPC. To confirm that this 13 digit sequence is valid, we perform the following computation. 24

1 3 1 3 1 3 1 3 1 3 1 3 1 Sum 9 7 8 0 3 8 7 9 4 7 5 3 2 9 21 8 0 3 24 7 27 4 21 5 9 2 140 If the sum is evenly divisible by 10, then the sequence is valid. This scheme does not detect all transposition errors as the older ISBN scheme did. Its use started because more ISBNs were needed than the old scheme could provide. Perhaps the method to create them was changed to make it more compatible with other identification number schemes, such as UPC. 25