0% found this document useful (0 votes)
6 views

Week 15 Cryptography

The document discusses cryptography, focusing on the processes of encryption and decryption using the Caesar cipher and modulo operator. It explains how to encrypt and decrypt messages through examples, detailing the steps involved in both methods. Key concepts include the use of a shift cipher and the modulo operation to transform plain text into coded messages and vice versa.

Uploaded by

8kf5ysrt85
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Week 15 Cryptography

The document discusses cryptography, focusing on the processes of encryption and decryption using the Caesar cipher and modulo operator. It explains how to encrypt and decrypt messages through examples, detailing the steps involved in both methods. Key concepts include the use of a shift cipher and the modulo operation to transform plain text into coded messages and vice versa.

Uploaded by

8kf5ysrt85
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

CRYPTOGRPHY

ENCRYPTING AND DECRYPTING MESSAGES USING CEASAR


CIPHER AND MODULO OPERATOR

KATHRYN SHARON S. PE BENITO, MA ED,Ddiv.


CRYPTOGRAPHY
The word CRYPTOGRAPHY originated from two greek words,
“krypto” which Means hidden and “graphene” which means writing. It is
the making or breaking of secret codes. It uses two processes namely:
1.) ENCRYPTION – the process of transforming plain text into code form
using a certain algorithm.
Example: Math is fun (plain text) ----- original message
PDWK LV IXQ (coded form) ----- Cipher text

2.) DECRYPTION – the process of converting back the coded message


into plain text.
CRYPTOGRAPHY
*KEY – refers to the strings of information that is used to reveal the
encrypted message into readable form.

Methods of Cryptography:
1.) Shift Cipher (Ceasar Cipher)
2.) Using a Modulo Operator

SHIFT CIPHER – the simple type of substitution cipher. It uses shift in


forming the key of cryptography.
Example 1: Using the key of shift of 3 to the right, encrypt the word
“CRYPTOGRAPHY.”
CRYPTOGRAPHY
Example 1: Using the key of shift of 3 to the right, encrypt the word
“CRYPTOGRAPHY.”
Solutions:
Step 1: Write the letters of the English alphabet.
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Step 2: Make 3 shifts from the given letter going to the right.

ABCDEFGHIJKLMNOPQRSTUVWXYZ
This means that after shifting C thrice to the right, its equivalent is F.
Step 3: Form the encrypted message. CRYPTOGRAPHY – FUBSWRJUDSKB
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDEFGHIJKLMNOPQRSTUVWXYZ
CRYPTOGRAPHY
Example 2: Decrypt to cipher text, “BJY DN BJJY”, using the key of 5 shifts to
the left.
Solutions:
Step 1: Write the letters of the English alphabet.
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Step 2: Make 5 shifts from the given letter going to the right (opposite of the
given direction when the process involved is decryption).
ABCDEFGHIJKLMNOPQRSTUVWXYZ

This means that after shifting B five times to the right (opposite direction, its equivalent is G.
“BJY
Step 3: Form the DN BJJY”
encrypted – “GOD IS GOOD”
message.
ABCDEFGHIJKLMNOPQRSTUVWXYZ
CRYPTOGRAPHY
USING MODULO OPERATOR – the sender of the message uses the key K
to encrypt and to decrypt the secret message. The key K may have any
integer value from 0 to 25 and this will be shared to the person/s who
will be receiving the secret message.

Steps in Encrypting Message:


Step 1: Express the letters of the alphabet into an integer from 0 to 25,
that matches its order, for example, A=0, B=1, C=2, . . ., then label
them as C.
Step 2: Calculate Y = (C + K)mod26, for every letter of message.
Step 3: Convert the number Y into a letter following the order of the
letter of the alphabet.
CRYPTOGRAPHY
Example 1: Encrypt the message “MMW is fun to learn.” Let k = 5.
Following the steps, here’s the solution:
Step 1: ABCDEFGHIJKLMNOPQRSTUVWXYZ
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

Step 2: M M W I S F U N T O L E A R N
12 12 22 8 18 5 20 13 19 14 11 4 0 17 13 C
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 +K
17 17 27 13 23 10 25 18 24 19 16 9 5 22 18 C+K

Step 3: Since 27 exceeded 25, apply modulo operator to find its equivalent.
That will be Y = 27mod26 which is equal to 1. Converting every Y into a
letter in the english alphabet we have RRB NX KZS YT QJFWS.
ABCDEFGHIJKLMNOPQRSTUVWXYZ
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
CRYPTOGRAPHY
Steps in Decrypting Message:
Step 1: Express the letters of the alphabet into an integer from 0 to 25,
that matches its order, for example, A=0, B=1, C=2, . . ., then label
them as Y.
Step 2: Calculate C = (Y – K)mod26, for every letter of the decrypted
message.
Step 3: Convert the number C into a letter following the order of the
letter of the alphabet.

Example 2: Decrypt the message “RRB NX KZS YT QJFWS”.


Let k = 5.
CRYPTOGRAPHY
Example 2: Decrypt the message “RRB NX KZS YT QJFWS”. Let k = 5.
Here’s the solution:
Step 1: ABCDEFGHIJKLMNOPQRSTUVWXYZ
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

R R B N X K Z S Y T Q J F W S
Step 2: 17 17 1 13 23 10 25 18 24 19 16 9 5 22 18 Y
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 – K
12 12 - 4 8 18 5 20 13 19 14 11 4 0 17 13 Y–K

Step 3: Determine the equivalent of –4 (by shifting 4 units to the left or


backward). –4 corresponds to W. Converting every C into a letter in the
english alphabet we have ”MMW IS FUN TO LEARN.”
End of session
You may ask your questions now.
Are there any? If there are no more
questions, prepare for your offline
task.

You might also like