Codes Cryptography
Codes 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 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
6
HOW ARE MESSAGES SENT?
1.
SENDER COMPOSES A MESSAGE OR 3.
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.
9
ACTIVITY 10 – CAESAR CIPHER
Instruction: Write your answers on a sheet of paper then encode them in the google form for Activity 10.
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
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
• 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
DECRYPTION VALUES
Example 2 for Decimation Cipher, USING p = 19, encode JEAN
Encryption Value Decryption Value
message J E A N ( p ) - key (i)
Original
position 9 4 0 13 3 9
no.
5 21
Original
position
171 76 0 247
is x 19 7 15
Since the
given p is
19
9 3
Divide by 26 since 171 is more 11 19
New
position 15 24 0 13
( pimod26 ) than 26, there is no 26 in the table.
The The remainder is 15. 15 7
remainder
if pi mod26 17 23
is equal to
or more
than 26 19 11
Replaced
letters
P Y A N 21 5
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
Encryption Value ( p ) - Decryption Value ( i )
Decryption Example 1: key
Using p = 5, decrypt M K O U N K U 3 9
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 = 23
were greater than 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
3 9
Decrypt: 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
Table of DECIMATION CIPHER
ACTIVITY 11 - 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 11. 3 9
b. USE CAPITAL LETTERS 5 21
c. NO SPACE BETWEEN LETTERS
7 15
d. NO SPACE BETWEEN WORDS
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