CH.6 Ed.5.30
CH.6 Ed.5.30
Learning Objectives
Introduction
Individuals, groups or organizations who are engaged in highly confidential matters use secret
codes in sending messages for security and privacy purposes. This will keep the secrecy of transactions
or communications intended only for the sender and receiver who can understand and process it. The
other uses of codes are for creating passwords in computer, secret accounts such as digital currency or
online accounts. Coding is also use for authenticity and non-repudiation of information for protection
against fraud, hackers or intruders, and there are a lot more uses of codes in everyday life and to name
just a few. This method of encoding messages through secret codes is known as encryption, and the
study of writing or solving secret codes is called cryptography.
Alphabet 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 z
Cipher d e f g h i j k l m n o p q r s t u v w x y z a b c
Answer: convert the cipher letters to the original alphabet by referring to table 6-1. since the given
is the cipher text, then, look for the equivalent plaintext(alphabet) of each cipher’s letter just above it.
Then, the message means: “ yes sir we are always ready”
Answer: “no one is great enough without the touch of his divine inspiration”
Encrypt the message “ study hard for a brighter tomorrow” by transposition cipher with a keyword
“ beauty”
b e a u t y
(2) (3) (1) (5) (4) (6)
s t u d y h
a r d f o r
a b r i g h
t e r t o m
o r r o w
The encrypted message is written vertically downward from numbers 1-6:
Encrypt the message “ the true hero is one who conquers his own anger and hatred” by
transposition cipher with a keyword “ heroism”
Solution: There are 7 characters in the keyword ”heroism” then construct 7 columns, write the
plaintext horizontally and vertically for the encrypted message by following the
alphabetical order which starts at the column of letter “e”(#1) , next is column of
letter “h” (#2) up to the last column of “s” (#7)
h e r o i s m
(2) (1) (6) (5) (3) (7) (4)
t h e t r u e
h e r o i s o
n e w h o c o
n q u e r s h
i s o w n a n
g e r a n d h
a t r e d
Solution: There are 36 characters to be decrypted and the key word has seven(7) characters, then,
construct 7 columns and 6 rows that may accommodate 42 characters. You may write “x” for last 6 non-
sense characters or 6 excess spaces, and write the message to be decrypted downward starting from
column of letter ”a”(#1), next is column of “e”(#2) up to the last column “t”(#7).
p a r e n t s
(4) (1) (5) (2) (3) (7) (6)
t o t o l e r
a t e e v e r
y t h i n g i
s t o t e a c
h n o t h i n
g x x x x x x
Write the decrypted message horizontally “to tolerate everything is to teach nothing “
The sender encrypts the plaintext using the public key, and the receiver decrypts the cipher text
with their own private key.
Step 4. Choose integer “e “ such that gcd( greater common divisor), [( n ), e] = 1
and “e” must be in the interval of one(1) and ( n) or 1 < e < ( n ).
also, “e” has no common factors in ( n).
1 + ( n )∗k
d= , select k =1, 2.3…that makes [1 + ( n ) ∗ k] divisible by “e”
𝑒
Step 6. The sender encrypts a message, M, with the public key (e, n), create the ciphertext, C,
using the formula:
C = 𝑴𝒆 mod(n}, where M<n, and mod(n) represents denominator “n’
. Step 7. The receiver decrypts the ciphertext for message(plaintext) “M” with the private key
(d, n) using the formula:
M = 𝑪𝒅 mod n, the private key is (d,n)
Determine the public and private keys in RSA algorithm with p= 11, q = 5 , and e = 3, then encrypt
the message “ passed”.
Solution:
Step 1. p= 11, q = 5
Step 2. n = p(q) = 11(5) = 55,
Step 3. ( n) = ( p – 1 ) ( q – 1 ) = (11-1)(5-1) = 40
Step 4. e = 3, not a factor of n = 55
Step 5. ( n) = 40 , *k = 2 , to make the numerator divisible by “e”
Thus , the public key is (3, 55), and the private key is ( 27, 55)
Step 6. To encrypt the message “passed” convert the characters into numbers using the table:
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
03 0
𝑐2 = = = 0 remainder 00
55 55
183 5,832
𝑐3 = = = 106 remainder 02
55 55
183 5,832
𝑐4 = = = 106 remainder 02
55 55
43 64
𝑐5 = = = 1 remainder 9
55 55
33 27
𝑐6 = = = 0 remainder 27
55 55
𝑀1 = 𝑐1 𝑑 [mod(n)]
𝑀1 = 2027 [mod(55)]
The decrypted message is 15 00 18 18 30 10, and convert to letters from table 1, whereas, the message
is “passed”
Determine the public and private keys and encrypt the message “regroup” given p = 19, q = 11 and
e = 17.
Solution:
Step 1. p= 19, q = 11
Step 2. n = p(q) = 19(11) = 209
Step 3. ( n) = ( p – 1 ) ( q – 1 ) = (19-1)(11-1) = 180
Step 4. e = 17, not a factor of n = 190
Step 5. ( n) = 40 , *k = 5 , to make the numerator divisible by “e =7”
1 + ( n )∗(k) 1 + 180(5)
d= = = 53
17 17
Thus , the public key is (17, 209), and the private key is ( 53, 209)
Step 6. To encrypt the message “ be brave” convert the characters into numbers using the table:
The characters are translated to: 01 04 01 17 00 21 04 representing “M” in the formula.
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 z
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
417 1.71798692𝑒10
𝑐2 = = = = 82,200,331 r. 21
209 209
117 1
𝑐3 = = = 0 r. 1
209 209
1717 8.27240262𝑒20
𝑐4 = = = r. 3.98508738e18. r 2
209 209
017 0
𝑐5 = = = 0 remainder 0
209 209
2117 3.00419425𝑒22
𝑐6 = = = 1.437413352e20 remainder 75
209 209
117 1
𝑐7 = = = 0 remainder 1, Thus, the encrypted message is 0121010207501
209 209
1. Determine the public and private keys, and encrypt the message “ faster” with p=31, q=5, e=3
using RSA-public key algorithm.
2. Decrypt the ciphertext in problem #1 using a private key of (1, 155) in RSA-public key
algorithm.
The Vigenère cipher(pronounced as viz-ner),is the given name in recognition to the French
cryptographer Blaise de Vigenère, who devised a similar cipher in 1586. It is an algorithm method of
encrypting and decrypting alphabetic text where each letter of the plaintext is translated into distinct
Caesar cipher, using Vigenère table and the increment is determined by the corresponding letter of
another text, the keyword.
Encrypt the message “ SUCCEED” using Vigenère cipher and the key word “MATH”
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 z
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Translate “MATH” to numbers: 12 00 19 07, then, take there numbers as the number of shift of the
characters, where the numbers from key word are repeated“ be successful” S(12), U(0),C(19),
C(7),E(12), S(0), S(19), F(7), U(12),L(0).
With the aid of the Vigenère cipher table, each letter are shifted with their corresponding numbers,
Such that “S” is shifted by 12, and converted to ciphertext “e”, “U” is shifted by 0, and so, remains the
same letter “u”, C is shifted by 19, and translated to “v”, another “C” shifted to 7 and becomes “j”, “E”
shifted by 12 and translated to “q” and by following the same steps, the encrypted message or cipher
text is “ euvjqew”
Decrypt the ciphertext “ EUVJQEW” from example #2 using the Vigenère cipher with the same
key.
Solution: To decrypt the message, do the reverse shift from left to right using Vigenère table.
E(-12), U(0), V(-19), J(-7), Q(-12), E(0), W(-7).
Encrypt the message “ GO TO THE LIBRARY’ using the Vigenere cipher and the key word “books”.
Exercise 6.2
1. Encrypt the message “WE SHALL LEAVE TOMORROW” with the key word “FIGHT” using
Vigenère cipher code.
2. Decrypt the message “ OVVZV HZVZ YQ” with the key word “BRAVE” using the Vigenère
cipher code.
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 z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Solution: From English alphabet mod 26 the corresponding number for s is 18 as follows:
Since the keyword is “s” which is Ki =18, place the keyword or letter “s” before the plain text, then
replace each by Pi values from table of alphabet. If C = 𝑃𝑖 +𝐾𝑖 ≥ 26 subtract C by 26 for Mod 26. The last
letter of the plain text will be disregarded as shown in the table below.
Plain text s t o p b u l l y i n g u s
Pi values 18 19 14 15 1 20 11 11 24 8 13 6 20 18
W/ keyword “s” s s t o p b u l l y i n g u
Keystream with
18 18 19 14 15 1 20 11 11 24 8 13 6 20
𝐾𝑖 = 18
C = 𝑃𝑖 +𝐾𝑖 36 37 33 29 16 21 31 22 35 32 21 19 26 38
Ci (Mod26) 10 11 7 3 16 21 5 22 9 6 21 19 0 12
Cipher text k l h d q v f w j g v t a m
Illustrative Example 6-14. Decrypt the message “klhdqvfwjgvtam” by autokey cipher encryption with
an auto key of “s”.
Solution: convert each letter to the equivalent number from table of alphabet. Place the auto key (s=18)
as first letter of the message. Compute for C values using the formula Ci = (Pi - Ki ) mod 26, add 26 if the
difference is negative, then, look for the equivalent number from the table from the plain text.
Exercise 6.3
1. Encrypt the message “ never give up” with an auto key of ‘h”, then, decrypt the
resulting message.
2. Encrypt the message “do the exercises ” with an auto key of ‘G”, then, decrypt
the resulting message.
2. Which of the following is the process of writing or encoding messages and transform into
secret codes from readable to unreadable forms ?
a. encryption b. cypher coding c. decryption d. KSA
3. _____ is an 1D barcode used to identify and distinguish products and are mostly printed on
retail product packaging and labeling to determine the identity of each product.
a. encryption b. UPC c. decryption d. KSA
4. What is the process of transforming an encrypted message back to its original form from readable
to unreadable format?
a. encryption b. decryption c. cypher coding d. KSA
5. ______is a secret keys which is used for an encryption algorithm that generates session keys
for encryption and decryption to secure a communication session.
a. encryption b. KSA c. decryption d. UPC
6. The process of transforming an encrypted message back to its original form from unreadable to
readable format is called____
a. decryption b. cypher coding c. encryption d. KSA
8. A code which was used by Julius Caesar to send secret message to his troop in 58 BC, by way
of shifting letters in a message to make it unreadable if intercepted.
a. Caesar’s cipher b. Julius code c. KSA code d. UPC code
9. What is the encrypted message for the plaintext” passed” in Caesar cipher” with a shift of 2?
a. qbttfe b. rcuugf c. sdvvhg d. tewwih
10. What is the decrypted message for “Pdwkhpdwlfv” in Caesar cipher” with a shift of 3?
a. mathematics b. dizzymaking c. puzzlements d. Juvenilized