Codes Cryptography
Codes Cryptography
-CRYPTOGRAPHY-
A. CAESAR CIPHER
B. DECIMATION CIPHER
Prepared by:
PROF. JEAN D. CENTINA
DAVAO DEL NORTE STATE COLLEGE
2
Importance of Cryptographic Programs
• Prevent hackers from
• using your email address
• Making calls using your mobile number to access private information
• Used to determine first-hand data communicated through electronic
transactions
• Example:
• USA President Bill Clinton and Ireland President Bertie Ahern used
unique signing code to ensure authenticity of intergovernmental
document
3
CRYPTOGRAPHIC PROGRAMS
A. Caesar Cipher
• Also known as Caesar Code
• Used by Julius Caesar in sending messages to his troops.
• Makes use of the letters of the English alphabet with integers 0 to 25
A -0
B -1
C - 2
D - 3 ; and so on…
4
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
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
Example:
X, Y, and Z are replaced with
B in a message is replaced by E (1 + 3 = 4)
A, B, and C, respectively!
F is replaced by I (5 + 3 = 8)
L is replaced by O (11 + 3 = 14)
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
A B C D E F G H I J K L MN O P Q R S T U V W X Y Z
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
6
HOW ARE MESSAGES SENT?
1.
SENDER COMPOSES A MESSAGE 3.
OR INFORMATION IN PLAINTEXT THE CODED MESSAGE IS SENT TO THE RECEIVER.
2.
THE MESSAGE IS CONVERTED TO CODED FORM
CIPHERTEXT – the result of encryption; 4.
ENCRYPTION – the process of making the
message unreadable anyone except to the one THE MESSAGE IS CONVERTED BACK TO CODED
with the key. FORM (CIPHERTEXT – the result of encryption)
7
EXAMPLE 1
Using the table below, encrypt the message: “WE ARE CLOSE TO VICTORY”
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
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
SOLUTION:
• MESSAGE WE ARE CLOSE TO VICTORY
• Replace the letters ZH DUH FORVH WR YLFWRUB -the encrypted message
of the message
with the letters in
the second row.
answer: ZHDUHFORVHWRYLFWRUB
8
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
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
EXAMPLE 2
SOLUTION:
• MESSAGE PDWKHPDWLFVLVEHDXWLIXO.
Answer : MATHEMATICSISBEAUTIFUL
9
ACTIVITY 9 – CAESAR CIPHER
Instruction: Write your answers on a sheet of paper then encode them in the google form for Activity 9.
A. Using CAESAR CIPHER Table, give the equivalent letter for each of the letters in the English alphabet. (26
points)
CAESAR CIPHER
A B C D E F G H I J K L MN O P Q R S T U VWX Y Z
D E F G H I J K L MN O P Q R S T U VWX Y Z A B C 10
CODES
-CRYPTOGRAPHY-
B. DECIMATION CIPHER
Prepared by:
PROF. JEAN D. CENTINA
DAVAO DEL NORTE STATE COLLEGE
15 X 7 = 105 23 17
105mod26 = 1 25 25
14
Example :
Encrypt the message “BIOLOGY IS A NATURAL SCIENCE” using decimation cipher and p = 5 .
DECIMATION CIPHER TABLE
LETTERS 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
POSITION
NUMBER 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
Steps Solution
B I O L O G Y I S A N A T U R A L S C I E N C E
• Position 1 8 14 11 14 6 24 8 18 0 13 0 19 20 17 0 11 18 2 8 4 13 2 4
• Position x 5 5 40 70 55 70 30 120 40 90 0 65 0 95 100 85 0 55 90 10 40 20 65 10 20
( let p = 5)
• New position 5 14 18 3 18 4 16 14 12 0 13 0 17 22 7 0 3 12 10 14 20 13 10 20
( pi mod26 )
Based on the F O S D S E Q O M A N A R W H A D M K O U N K U
new position, The encrypted message.
replace with the
corresponding
letter 15
DECIMATION CIPHER TABLE
LETTERS 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
POSITION
NUMBER 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
Table of DECIMATION CIPHER
Example 2 for Decimation Cipher, USING p = 19, encode JEAN DECRYPTION VALUES
message Encryption Value Decryption Value
J E A N
( p ) - key (i)
Original
position
9 4 0 13 3 9
no.
Original 171 76 0 247 5 21
position
is x 19 7 15
Since the
given p is Divide by 26 since 171 is more 9 3
19
New
than 26, there is no 26 in the table. 11 19
15 24 0 13
position The remainder is 15.
( pimod26 ) 15 7
The
remainder 17 23
if pi mod26
is equal to 19 11
or more
than 26
21 5
Replaced
P Y A N
letters 23 17
ANSWER: PYAN 25 25
DECIMATION CIPHER TABLE
LETTERS 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
POSITION
NUMBER 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
DECRYPTION Table of DECIMATION CIPHER DECRYPTION VALUES
Using p = 5, decrypt M K O U N K U 3 9
In decryption, encryption value p = 5 5 21
has decryption value i of 21 . 7
Copy the message, give enough
15
space between letters.9 3
Solution:
11 19
M K O U N K U Original position number
15 7
original position number multiplied by 21
12 10 14 20 13 10 20 17
(the i or decryption value for 5)
23
Multiply by 21 19 11
252 210 294 420 273 210 420 The remainders,
21 after 5
dividing by 26 (numbers
Using pi mod 26 = were greater23than 26) 17
18 2 8 4 13 2 4 25 25
Letters corresponding to numbers above them
S C I E N C E (answer) 17
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
Table of DECIMATION CIPHER DECRYPTION VALUES
DECRYPTION
Encryption Value ( p ) - Decryption Value ( i )
Example 2 key
Decrypt: 3 9
5 21
LFSAG
7 15
Use encryption value p = 11. 9 3
Solution: 11 19
L F S A G 15 7
17 23
11 5 18 0 6 19 11
Multiply by 19
21 5
209 95 342 0 114
23 17
pi mod 26 =
25 25
1 17 4 0 10 (Remainders)
B R E A K (answer)
18
ACTIVITY 10 - DECIMATION CIPHER Table of DECIMATION CIPHER
DECRYPTION VALUES
Instructions:
Encryption Value Decryption Value
a. Write your answers first on a sheet of paper then ( p ) - key (i)
encode them in the google form for Activity 10. 3 9
b. USE CAPITAL LETTERS
5 21
c. NO SPACE BETWEEN LETTERS
d. NO SPACE BETWEEN WORDS 7 15
9 3
1. Use the decimation cipher with the key 17 to encrypt the 11 19
phrase 15 7
I LOVE TO DANCE. 17 23
2. Use the decimation cipher with the key 9 to encrypt 19 11
DAVAO DEL NORTE. 21 5
23 17
3. Decrypt: GUVCPN, encryption value p = 7 25 25
DECIMATION CIPHER TABLE
LETTERS 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
POSITION
NUMBER 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 1925