You are on page 1of 14

Module 8

CODING THEORY AND CRYPTOGRAPHY

Exercise 1.1

Provide the answer to each the problem

1. Evaluate the following modular operations:

a. (47+26) mod 15
Answer: (47+26) congruent 13(mod 15) rem 13
b. (25-32) mod 9
Answer: (25-35) congruent 0(mod 9)
c. (13)(32) mod 14
Ans: (13)(32) congruent 10(mod 14)

2. Determine the value of the following:

a. Additive inverse of 6 mod 10


Ans: 6 mod 10=10 mod 10
b. Multiplication inverse of 5 mod 11
Ans: 5 congruent 9 (mod 15)
c. Multiplication inverse of 6 mod 15
Ans: 6 congruent 10 (mod 15)

3. In a 12-hour clock, determine the time 

a. 55 hours after 7 o'clock 


Ans: 3 o'clock 
b. 25 hours before 2 o'clock 
Ans : 1 o'clock

4. In exactly 125 days, the country will commemorate Labor Day (May 1).

a. If today is Tuesday, what day of the week is Labor day?


Ans: Thursday
b. What day will Labor day be after 10 years?
Ans: Friday
c. What day was Labor Day 10 years ago?
Answer: Monday
For numbers 5 and 6, determine whether the given ISBN code is valid or not. If the
code is not valid, give the correct check digit.

 5. 978 - 971 - 98- 0456 - 6


Ans: =10-(153 mod 10)
         =10-3
         =7 not valid

6. 978 - 013 - 14 - 3747 - 1


Ans: =10-(144 mod 10)
         =10-4
         =6 not valid

For number 7 and 8, determine whether the given UPC number is valid or not. If
the number is not valid, give the correct check digit.

 7. 3 - 8137 - 115208 - 7


Ans: =10-(110 mod 10)
         =10-19
         =0 valid
         =0 valid

 8. 000 - 396 - 01593- 6


Ans: =10-(110 mod 10)
         =10-0 valid

For numbers 9 and 10, determine whether the given credit card number is valid or
not.

 9. 3 - 8137 - 115208 - 7


Ans: =10-(122 mod 10)
         =10-2
         =8 not valid

10. 000 - 396 - 01593- 6


Ans: =10-(102 mod 10)
         =10-2
         =8 not valid

Exercse 1.2

Group Work. Follow the instructions below.

1. From groups 4-5 members. Assign a leader.


2. Design a Formula that can check the validity of a 5- digit code. For you to this, read
about the theory behind the modulus 10 in ISBN and UPC system. Do you think you can
use the same modulus in a 5-digit code?

3. The assigned leaders will represent the group's output to the entire class. 

UCP DIGIT
8-06502-35009-6
X¹ =8          X⁷=3
X²=0           X⁸=5
X³=6           X⁹=0
X⁴=5           X¹⁰=0
X⁵=0           X¹¹=9
X⁶=2           X¹²=6
6x¹+x²+6x³+x⁴+6x⁵+x⁶+6x⁷+x⁸+6x⁹+x¹⁰+6x¹¹+x¹²=0(mod 10)
0-00007-74778-4
6x¹+x²+6x³+x⁴+6x⁵+x⁶+6x⁷+x⁸+6x⁹+x¹⁰+6x¹¹+x¹²=0(mod 10)
6(0)+0+6(0)+0+6(0)+7+6(7)+4+6(7)+7+6(8)+4=0(mod 10)
0+0+0+0+0+7+42+4+42+7+48+4=0(mod 10)
                                                     154=0(mod 10)
Answer: Invalid
              False statement: 154=0(mod 10)

*Do you think you can use the same modulus in 5-digit code?
Ans: Yes 

Assignment 

Watch the video clip and complete the statements that follow.

 The Imitation Game


hhttps://www.youtube.com/watch?v=0DFqSmdbsUM

1. Three things that I significantly learned from the video clip.

 I learned that do good work to get good work


 Playing a genius certainly doesn't make you smarter
 Recognize and respect the abilities of women

2. Three things that are still unclear for me

 Is the imitation game a real story?


 Who was the soviet spy in the imitation game?
 What does he mean with you are paying attention?
3. I used to think that

 Nowadays everyone uses computer and mobile phone, but fee knew that Alan
turning was the inventor.
 How intelligent people solve difficult problems.
 Sometimes what human are scared of the most, is something that is smarter or
more efficient of something that isn't themselves.

4. Three Questions that I want to ask

 What are these major problem?


 What did they get wrong about code breaking?
 Why it is called the imitation game?

Exercise 2.1

Answer the following problems.

1. Determine the decimal number tht is equivalent to each of the given binary number:

a. 1001011
            Answer: 75
                  
b. 110011
            Answer: 51

c. 101101
Answer: 45

2. Convert the following decimal numbers into binary numbers:

a. 365
           Answer: 011100001

b. 875
           Answer: 1101011011

c. 1362
            Answer: 01001010001
3. Find the sum:

a.        11001                                                                               b.           1011011
+       1010                                                                                     +          10011
                      36                                                                                                     76
                    
Use the table of 5-bit codes for the letters of the alphabet to answer Problems 4
and 5.

4. Translate the following into binary codes.

a. I AM NEVER LATE IN CLASS


answer:
0100100000000010110100000011100010110110001011001000000011000000110100
00101000000100101110000000001101100000011001110011.

b. EXPERIENCE TEACHES THE BEST LESSON IN LIFE.


answer:
0010111000100000010110010010010010101110000110010100000101000010100001
0001101000001011001100000101000100000101000000001000101100111010000000
0110000101100111001101111011100000001001011100000001100010010011000101

5. Translate the foloowing binary code into English setence.

a. 0011101111001000000000010011000010111001110011000001010001000001
010000010000010000100100110001001100001000001001011100010110011
           
Answer: GOD BLESS THE PHILIPPINES

b. 0110101000010101100010100000001011011000101101011001000000000100
01110100001001011110111000000000110111110101011101010010011

Answer: MAKE EVERY ACTION COUNTS.

For numbers 6-8, consider the following binary code: 1100010101100

6. To form a Hamming code, how many additional bits and form the Hamming code?
          To better understand how many additional bits in the original code. Note
that the nearest power of 2 that is less than 5 (the number of bits in the given
code) is 4 (you is 2¹) this means that you have to allocate 2+1=3 more bits
position in the given code. 
7. What are the positions of the additional bits?
    Answer: The position of the additional bits ? ? 1 ? 1 0 0 0 1 0 1 0 11 0 0

8. Find the values of the additional bits and form the Hamming code.
              
The Hamming code must then be: 1100010101100

1100010101100
           solution:  ??1?100010101100
                          p-1= ? 1  1  0
                          p-2= ?  1  0  0
                          p-4= ?  1  0  0

so p-1 = 0,p-2= 1,p-4= 1


the answer is anwer:  0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 0

9. Final a Hamming code for each of the following binary codes 

a. 011011
answer:  110011011

b. 100110101
            answer:  001100110101

10. Suppose the following Hamming codes were created using even parity, determine if
the code is correct or not. If not correct Hamming code.

a. 000011001010 - CORRECT

b. 101110001100 - NOT CORRECT


             answer:  001110001100

c. 010101100011 - NOT CORRECT


answer: 100110101

d. 100110101 - NOT CORRECT


 answer: 100100101
Exercise 2.2

Group Work. Follow the instructions below.

1. From the group 4-5 members. Assign a leader.


2. Formulate an analogous scheme for error and error correction for binary codes with 2
error bit.
3. The assigned leaders will present the group's output to the entire class

Assignment 

Watch the video clip and complete the statements that follow.

 The Story of Binary Numbers


https://www.youtube.com/watch?v=QWk6UjfTETQ

1. Three things that I significantly learned from the video clip.


Assignment (The Story of Binary Codes) 
The video clip tells that there is an evolution in measuring and counting,
mathematics is the face of everything, and world is made and full of units.

2. Three things that are still unclear to me

Mostly I understood the video that I’ve watched.

3. I used to think  that

The Binary codes have a mathematical description behind it. When I was
thinking before I watch the video clip, I used to believe that Binary codes
don’t have any related functions in our daily lives. However, I realize that
these are products of mathematical concepts.

4. Three questions that I want to ask the video clip

 How do you actually explain Binary codes?


 Without Binary codes, can we still live?
 In what part of our life we can apply Binary codes?

Exercise 3.1 

1. Specify the encryption using the Shift Cipher method for the following values of K

a. K=2
            C=(P+30) MOD 26
           15+20= 35 MOD 26

| A|B |C |D |E |F |G |H |I  |J |K |L  |M


| 0|1  |2  |3  |4 |5 |6 | 7  |8 |9 |10|11 |12
|N |O |P |Q |R |S |T |U |V|W|X|Y|Z
|13|14|15|16|17|18|19|20|21|22|23|24|25

CIPHER MESSAGES
|P |R |A |Y |F |O |R |M |A |R |A |W |I
|15|17|0|24|5|14|17|12|0 |17|0 |21| 8
ORIGINAL POSITIONS

SHIFTED POSITIONS  |35|


PLAIN OR ORIGINAL MESSAGE |Y|

b. K=11
            C= C(P+11) MOD26
            5=11 = 26 MOD 26

2. Specify the decryption cipher using the parameters in Problem 1.


    
    P=(C-K) MOD26
    P=(C-20)MOD26
           214   MOD26
    P=(C-K) MOD 26
    P= (6-11) MOD26
       = 65 MOD26

3. Using Affline Cipher, specify the encryption cipher for the following specified
parameters.

a. (m,K) = (7,10)
(m,K) = (7,10)
           (m,k) : ( mp+k) mod26
           (m,k) = (7,10)
Formula
C= (7C+10) mod26
P =21(C+10) mod26
P =21(24+10) mod26
   = 21(34) mod26 
   714MOD26 =15

b. (m,K) = (15,8)

(m,k) = (15, 8)
     (m,k) P=¹ (c,k) mod26
                        m
               P= (15 P-8) mod26
                      (1 , k ) (=5-8)
                          m
    Solution
              P=5 (C-8)mod26
              P= 5(24- 8) mod26
                   5( 16) mod26
                   80 mod26=15
 
4. Using the same parameters in Problem 3 to specify the corresponding decryption
ciper.

a. (m,k) = (7,10)
            (m,k) : ( mp+k) mod26
            (m,k) = (7,10)
Formula
C= (7C+10) mod26

P =21(C+10) MOD26
P =21(24+10) MOD26
   = 21(34) mod26 
   714MOD26 =15

5. Apply Shift Cipher to encrypt the following messages;

a. Kill The Beast K = 12


  C=(P+12) mode 26
     =15+12=24 mod 26

OM  |K |I |L |L |T |H |E |B |E |A |S|T
OP   |10|8|11|11|17|7 |4 |1  |4  |0  |18|19
SP|23|2|24|6|20|17|14|17|14|17|13|5|6|
EM|X|U|Y|G|U|R|O|R|N|P|G|

b. I am coming home K = 18

         C=(P+12) mode 26
            =15+12=24 mod 26

OM  |K |I |L |L |T |H |E |B |E |A |S|T
OP   |10|8|11|11|17|7 |4 |1  |4  |0  |18|19
SP|23|2|24|6|20|17|14|17|14|17|13|5|6|
EM|X|U|Y|G|U|R|O|R|N|P|G|

6. Apply Shift Cipher to descrypt the following messages;

a. SLHCLLHYSF,K = 7
     
           K=7
OriginalMessage                                                                          
S|L|H|C|L|L|H|Y|S|F

Original Position
18|11|7|2|7|11|11|7|24|18|5

Shifted Position
25|18|14|9|18|18|14|31=5|25|12

Encrypted Message 
Z|S|O|J|S|S|O|F|Z|M
b. TMPBXHTPHN, K = 15

            K=15

OriginalMessage
T|M|P|B|X|H|T|P|H|N

Original Position
9|12|15|1|23|7|19|15|2

Shifted Position
34=8|27=1|30=4|16|38=12|34=8|30=4|22|28=2

Encrypted Message 
I|O|E|Q|M|W|I|E|W|C

7. Apply Affine Cipher using (m, K) = (5, 21) to encrypt the following message;

a. I will pass the board exam

I WILL PASS THE BOARD EXAM

Apply Affine Cipher using


 (m, K) = (5, 21) to encrypt the following message
i will pass the board exam.
Solution C= (5P + 21) mod 26

Original Message
I|W|I|L|L|P|A|S|S|T|H|E|B|O|A|R|D|E|X|A|M

Original Position
8|22|8|11|11|15|0|18|18|19|7|4|11|4|0|17|3|4|23|0|12

Shifted Position
9|1|924|24|18|21|7|7|12|4|15|0|13|21|21|0|15|6|21|3

Encrypted Message
J|B|J|Y|Y|S|V|H|H|M|E|P|A|N|V|C|K|P|G|V|D

b. Go home immediately

GO HOME IMMEDIATELY

Original Message
G|O|H|O|M|E|I|M|M|E|O|I|A|T|E|L|Y

Original Position
6|14|7|14|12|4|8|12|12|4|3|8|0|4|4|11|24

Shifted Position
25|13|4|13|15|9|3|3|15|10|9|21|12|15|24|11

Encrypted Message
Z|N|E|N|O|P|J|D|D|P|K|J|V|M|P|Y|L

8. Use the same cipher parameters in Problem 7 to decrypt the following message;

a. FNDJIZHNNI

Original Message
F|N|D|J|I|Z|H|N|N|I

Solution Cipher Message 


F|N|D|J|I|Z|H|N|N|I

Original Position
5|13|3|9|8|25|7|13|13|8

Shifted Position
2|14|12|8|13|6|18|14|14|13

Original Message COMING SOON= “Coming Soon”

b. MVTPVACPPVT

Original Message
M|V|T|P|V|A|C|P|P|V|T

Solution Cipher Message 


M|V|T|P|V|A|C|P|P|V|T

Original Position
12|21|19|15|21|0|2|15|15|21|19

Shifted Position
19|0|10|4|0|1|17|4|4|0|10
Original Message TAKE A BREEAK= "Take a breeak"

Exercise 3.2

Group Work. Follow the instructions below.

 From group of 4-5 members. Assign a leader.


 A day before this activity, each group is provided a material about the "Vegenère
Cipher." During the this activiy, the group is to formulate a cipher code following
the rules of the Vegenère cipher.
 The assigned leaders will synthesize the presentation of the members and
present it to the entire class.

Assignment 

Watch the video clip and complete the statements that follow.

 The Complexity of CODES


https://www.youtube.com/watch?v=sMQqK6NmRyc

1. Three things that I significantly learned from the video clip.


 We learned that Complexity of CODES, I can use counting the number of
operations and letters can also execute in the field of Mathematics.
 The article made me realize how important complexity of codes in our
generation.
 Complexity of mathematics is a part from this generation to generation.

2. Three things that are till unclear for me

Mostly I understood the video that I’ve watched.

3. I used to think that

              The Complexity of CODE is remarkable phenomenon to us learners. I


think it is more important to change my perspective to learn more and explore
about mathematics.

4. Three Questions that I want to ask

 How can I change my perspective?


 How important is Complexity of CODE in our lives?
 Is it possible to live without knowing the Complexity of CODE?

You might also like