Lesson Title: Codes and Cryptography Lesson Intended Learning Outcomes (Lilo)
Lesson Title: Codes and Cryptography Lesson Intended Learning Outcomes (Lilo)
LESSON GUIDE:
Learning Guide: Time Learning Resources
Allotment
1. Discuss and illustrate what modular
Mathematics in the Modern
arithmetic is.
World;
2. Explain and examples of codes applied to Week 16-17
Calingasan, et al
UPS, credit card,etc. (Week 18 is pp 315-344
3. Discuss and illustrate different security Final
systems such as shift cipher, etc. Examination)
Self-Directed Activity:
Look for an actual situation where you can apply
methods of codes and security.
LEARNING CONTENT:
Modulo n
Two integers a and b are said to be congruent modulo n, where n is a natural number, if
𝑎−𝑏
is an integer. In this case, we write a≡b mod n. The number n is called the modulus. The
𝑛
statement a≡b mod n is called congruence.
Furthermore, if a ≡ b mod n and a and b are whole numbers, then a and b have the same
remainder when divided by n or in ordinary terms, when we divide a with n, the remainder is b.
15−4
b. 15 ≡ 4 mod 6. This is false or not congruent because is not a whole number.
6
One simple application of this is in terms of determining the time using the 12-hour clock, like:
b) But what if the problem is; What 70 hours after 7 o’clock? So it will take time to count
70 hours from 8 o’clock. But what we can do is to add 70 hours to 7 o’clock and that
77
this will be 77. So using the formula, ≡ 5 mod 12. This means that it will be 5 o’clock.
12
Another important application of this concept is in Universal Product Code or UPC or bar
codes found in the different items like grocery and almost all items sold in the stores. They are
very helpful to keep track of inventory. This means that its purpose is to make it easy to
identify product features such as the brand name, item, size, etc.
The UPC is a 12-digit number that satisfi es a congruence equation that is similar to the
one for ISBNs. The last digit is the check digit. If we label the 12 digits of the UPC as d1, d2, ... ,
d12, we can write a formula for the UPC check digit d12.
d12 = (3𝑑1 + 𝑑2 + 3𝑑3 + 𝑑4 + 3𝑑5 + 𝑑6 + 3𝑑7 + 𝑑8 + 3𝑑9 +𝑑10 + 3𝑑11) mod 10 and based on this
formula, d12 should be 0, If not 0, then the UPC is not valid.
This can also be applied in determining whether a credit card is valid or not is calculated
by calculating the last digit using the following steps:
=Beginning with the next-to-last digit (the last digit is the check digit) and reading from
right to left, double every other digit. If a digit becomes a two-digit number after being
doubled, treat the number as two individual digits. Now find the sum of the new list of digits;
the final sum must be equal to sum mod 10. The last digit must be equal to d16 = 10-sum mod
10. (Example, if the sum is 34 then this is 4 mod 10, thus, the last digit is 10-4 =6.)
d16 = (𝑑15 +2 𝑑14 + 𝑑13 +2𝑑12 + 𝑑11 + 2𝑑10 + 𝑑9 + 2𝑑8 + 𝑑7 + 2𝑑6 + 𝑑5+2𝑑4 + 𝑑3 + 2𝑑2 + 𝑑1) mod
10
Example: Check if this is a valid Credit Card Number; 5234 8213 3410 1298.
d16 = (9 +2x2 + 1 +2x0 +1 + 2x4 + 3 + 2x3 + 1 + 2x2 + 8 +2x4 + 3 + 2x2 + 5) mod 10 = 65 mod
10 since this 5 mod 10, the credit card number is not valid.
COMMUNICATION SECURITY:
Classical Cryptosystems
Shift Ciphers
Each letter in the plaintext is replaced by a letter some fixed number of positions down
the alphabet
Each letter in the plaintext is replaced by a letter some fixed number of positions down
the alphabet
EXAMPLE:
c = (p + 11) mod 26
plain P R A Y F O R M A R A W I
p 15 17 0 24 6 14 17 12 0 17 0 22 8
C 0 2 11 9 17 25 18 23 11 2 11 7 19
ciphr A C L J R Z S X L C L H T
ciphr G U N B L O F Y M
C 6 20 13 1 11 14 5 24 12
p 12 0 19 7 17 20 11 4 18
plain M A T H R U L E S
Post Test:
Answer the following questions from the textbook: Mathematics in the Modern World;
Calingasan, et al
p 340 # 2, 4