Uploaded by Yuki Kanna

MODULE 8 - MMW

advertisement
GED102
WRITING EXERCISE (WE) (CO1)
Name: Panes, Pauline D.
Section: E01 Date: 11/30/2019
SIGNATURE
CODING THEORY AND CRYTPOGRAPHY
Coding is always associated with data compression, cryptology, error-correcting
and/or error detecting codes. As stated by www2.kenyu.edu, “the term ‘Coding
Theory’ has become associated predominantly with error-correcting codes.”
However, it is more than just mathematics; it almost covers all fields of study
particularly, computer sciences and information technology.
I.
MODULAR ARITHMETIC
A. MODULAR ARITHMETHIC
Modular arithmetic is a system of arithmetic for integers, where values reset to
zero and begin to increase again, after reaching a certain predefined value,
called the modulus (modulo).
a. Take for example the formula
𝑥−𝑦
, where the difference of x and y is
𝑛
divisible by n. In addition, we use the symbol “≅” to denote congruence
between x and y followed by mod n.
1. Example 1:
27 ≅ 2 mod 5, where 27 is x, 2 is y and 5 is n. Following the equation
𝑥−𝑦
27−2
, then substitute the given numbers which then would be
.
𝑛
5
Considering the difference of 27 - 2 is divisible by 5, the congruence is
correct.
2. Example 2:
(15 + 18) mod 9. When you add 15+18 the sum will be 33, then dividing it
to 9 will give you a quotient of 3 and remainder 6. When we follow the
15+18
33
the result will be 9 . To make it congruent, the
9
standard form will be (15+18) mod 9 ≅ 6.
equation,
B. IDENTITY AND INVERSE
The two arithmetic operations that will be featured here are the addition and
multiplication including their inverses. The identity element for additive is 0 and
the identity element for multiplicative is 1. For each integer m, is an integer b is
its additive inverse modulo n if m + b = 0 mod n. Similarly, b is multiplicative
inverse if (m)(b) = 1 mod n.
1. ADDITIVE INVERSE
a. Example 1:
Determine the value of the additive inverse of 9 mod 15.
Look for a number that when you add to 9 would result to 15. In this
case, 6 would do. 9 + 6 = 15 and this would result to 0. Thus, 9 + 6 =
15 ≅ 0 𝑚𝑜𝑑 15. Another alternative statement would be −9 ≅
6 𝑚𝑜𝑑 15. Because when you add 6 to 9 the result would be 15 and it
is congruent since 15 divided by 15 would equal to 0.
2. MULTIPLICATIVE INVERSE
a. Example 1:
Determine the value of the multiplicative inverse of 3 mod 5.
Look for a number that when you multiply to 3 would have a remainder
of 1 when divided by 5. In this case, 2 would be the best answer since 2
multiplied to 3 would result to 6 and when it is divided by 5 it would get a
remainder of 1. Such that (3)(2) = 6 ≅ 1 𝑚𝑜𝑑 5 and it can also be
stated as 3−1 ≅ 2 𝑚𝑜𝑑 5
C. INTERNATIONAL STANDARD BOOK NUMBER (ISBN)
The International Standard Book Number (ISBN) is a numeric commercial book
identifier which is intended to be unique. Publishers purchase ISBNs from an
affiliate of the International ISBN Agency.
In the Philippines, the National Library of the Philippines (NLP) takes charge of
the ISBN registration, allocation and designation for Filipino publishers and
authors. The ISBN code’s format is 𝑥1 𝑥2 𝑥3 − 𝑥4 𝑥5 𝑥6 − 𝑥7 𝑥8 − 𝑥9 𝑥10 𝑥11 𝑥12 −
𝑥13 . 𝑥4 is the country code while the remaining digits except for 𝑥13 are for
identifying the author and title of the book. 𝑥13 is the check digit which can be
obtained using the formula:
𝑥13 = 10 − (𝑥1 + 3𝑥2 + 𝑥3 + 3𝑥4 + 𝑥5 + 4𝑥6 + 𝑥7 + 3𝑥8 + 𝑥9 + 3𝑥10 +
𝑥11 + 3𝑥13 ) 𝑚𝑜𝑑 10
If 𝑥13 = 10, then the check digit is 0.
a. Example 1:
Determine the check digit for 978-971-27-2769.
Using the formula given,
𝑥13 = 10 − [9 + 3(7) + 8 + 3(9) + 7 + 3(1) + 2 + 3(7) + 2 + 3(7) + 6 + 3(9)]𝑚𝑜𝑑10
= 10 – (154 mod 10)
= 10 – 4
=6
The check digit is 6.
D. CREDIT CARDS
Credit cards can be checked by doubling every other digit in of the credit card
number. In this way, you can determine whether the card is valid or not. Simply
add every digit including the double ones, which are also to be treated
separately. The credit card number will only be valid when the sum of all the
digits under modulo 10 is congruent to 0.
a. Example 1:
5234 8213 3410 1298
To determine whether the credit card number is valid, we first have to create
a table.
DIGITS
DOUBLED
DIGITS(ALTERNATE)
5
10
2 3 4 8
2 6 4 16
2 1 3 3 4 1 0 1 2
2 2 3 6 4 2 0 2 2
Sum = 1 + 0 + 2 + 6 + 4 + 1 + 6 + 2 + 2 + 3 + 6 + 4 + 2 + 0 + 2 + 2 + 1 + 8 + 8
= 60 ≡ 0 mod 10
Since, the sum of all the digits is congruent to 0; the credit card number is
valid.
II.
BINARY SYSTEM AND HAMMING CODES
The most commonly used digits in the binary system are 1 and 0. Although, there
are instances where 0 – 9 is used and even letters A to F which are commonly used
in programming languages.
A. BINARY SYSTEM
The Binary System is a special system that uses the digits 0 and 1.
a. Example 1:
Consider the number 86 and convert it to binary number.
Start by making a table that gradually divides 86 by 2. Also take note that in
getting the binary number, you start from the right which is why the binary
number for 86 is 1010110.
NEW
DECIMAL
QUOTIENT
REMAINDER
86
43
21
10
5
2
1
43
0
21
1
10
1
5
0
2
1
1
0
0
1
B. BINARY SUM
Here are the sums of the elements:
SUM OF THE ELEMENTS
0+0
0+1
1+0
1+1
BINARY SUM
0
1
1
10
9
18
8
8
2 is not a part of the binary system that is why 10 is the binary sum when you
add 1 to 1. The 2 digits which are 1 and 0 represent the value of 2.
a. Example 1:
11000101
+ 01100110
100101011
C. BINARY CODES
Binary codes are strings of 1s and 0s. Each character in a string is called a bit
while a series of eight bits is called a byte.
KEY
SPACE
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
5-BIT CODE
00000
00001
00010
00011
00100
00101
00110
00111
01000
01001
01010
01011
01100
01101
01110
01111
10000
10001
10010
10011
10100
10101
10110
10111
11000
11001
Z
11010
a. Example 1
To figure out a message in the coded words you have to group them first by 5
bits.
0110100001101000100000000010011001100000001101010101110
01101 00001 10100 01000 00000 01001 10011 00000 00110 10101 01110
Using the table indicated above, the message is MATH IS FUN.
D. HAMMING CODES
The Hamming code is used for correcting errors. This uses a redundant bit or also
known as parity bit.
According to R.W. Hamming, we use parity bits in terms of 𝑃1 , 𝑃2 , 𝑃4 .
𝑃1 will be found based on the following data bits in the table which would be
𝐷3 , 𝐷5 , 𝐷7 ; 𝑃2 will be based on 𝐷3 , 𝐷6 , 𝐷7 ; 𝑃4 will be based on 𝐷5 , 𝐷6 ,
𝐷7 .
a. Example 1:
Consider the bit 10010. Each digit will be named 𝐷3 , 𝐷5 , 𝐷6 , 𝐷7
consecutively.
DIGIT
P1
?
P2
?
D3
1
P4
?
D5
0
D6
0
D7
1
D8
0
To get 𝑃1 , determine first the following data bits, 𝐷3 , 𝐷5 , 𝐷7 , which are 1,
0, and 1 consecutively. Adding the digits would result to 2. Now 2 is already
an even number, therefore, 𝑃1 is 0. Follow the same rules for both
𝑃2 𝑎𝑛𝑑 𝑃4 . 𝑃2 then, is 0 and 𝑃4 is 1.
III.
CRYPTOGRAPHY
Cryptography has been an important factor by means of communicating through the
internet. It has been relied upon a widespread of websites that ensures your safety.
A. CRYPTOGRAPHY
Cryptography involves in securing your data or information by converting them
into codes or unreadable formats. This also involves encryption that encodes a
message or info that only authorized parties can access and decryption that
recovers the encrypted information.
a. Example 1:
ENCRYPTION
Encrypt the phrase “MATH RULES” using a shift cipher K = 9.
A
B
C
D
E
F
G
H
I
J
0
1
2
3
4
5
6
7
8
9
N
O
P
Q
R
S
T
U
V
W
13 14 15 16 17 18 19 20 21 22
K
10
X
23
L
11
Y
24
M
12
Z
25
Shift every letter from their assigned number on the table using the given
cipher formula which is C = (P + 9) mod 26.
C = (12 + 9) = 21 mod 26. 21 is V therefore the encrypt message of M is V.
The same goes for the other remaining letters.
Original
Message
Original
Position
Shifted
Position
Encrypted
Message
M
A
T
H
R
U
L
E
S
12
0
19
7
17
20
11
4
18
21
9
2
16
0
5
20
13
27
V
J
C
Q
A
F
U
N
B
b. Example 2:
DECRYPTION
Decrypt the phrase “GUNBLOFYM” using a shift cipher K = 20.
Use the formula P = (C – K) mod 26.
Original
Message
Original
Position
Shifted
Position
G
U
N
B
L
O
F
Y
M
6
20
13
1
11
14
5
24
12
12
0
19
7
17
20
11
4
18
Encrypted
Message
M
A
T
H
R
U
L
E
S
P = (6 – 20) mod 26
= -14 mod 26
-14 indicate that it is the additive inverse of 14 modulo 26. In this case,
-14 ≅ 12 mod 26. The others will undergo the same process.
B. AFFINE CIPHER
This is basically cryptography made more complicated by adding multiplication
to make it more difficult to crack.
a. Example 1:
ENCRYPTION
C = (mP + K) mod 26 where m is the affine cipher.
Using the previous example, let m = 3 and K = 5.
C = (3*12 + 5) mod 26
C = (36 + 5) mod 26
C = 41 mod 26 = 15
The same process is applied to the remaining letters.
Original
Message
Original
Position
Shifted
Position
Encrypted
Message
M
A
T
H
R
U
L
E
S
12
0
19
7
17
20
11
4
18
15
5
10
0
4
13
12
17
7
P
F
K
A
E
N
M
R
H
b. Example 2:
DECRYPTION
We use the formula P =
1
𝑚
1
(C – K) mod 26, where 𝑚 is the affine cipher which
is also the multiplicative inverse of m.
Using the previous affine cipher, the inverse will be (9, -5). The formula will
now be P = 9 (C – 5) mod 26.
Cipher
Message
Original
Position
Shifted
Position
Encrypted
Message
Y
A
J
H
O
X
A
V
J
A
J
F
R
24
4
5
20
20
21
4
15
5
4
5
19
3
15
17
0
24
5
14
17
12
0
17
0
22
8
P
R
A
Y
F
O
R
M
A
R
A
W
I
P = 9 (24 – 5) mod 26
= 9(19) mod 26
= 171 mod 26 = 15
This process is the same for the remaining letters.
SOURCES
https://www.coursera.org/lecture/mathematics-for-computer-science/3-106-additive-identityand-inverse-mod-k-d5o4
https://whatis.techtarget.com/definition/Hamming-code
https://www.youtube.com/watch?v=1A_NcXxdoCc
https://en.wikipedia.org/wiki/Encryption
https://www.computerhope.com/jargon/d/decrypti.htm
MATHEMATICS IN THE MODERN WORLD, CHAPTER 8, 260 - 291
Download