Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Shift (Caesar) Ciphers If you have a message you want to ..., Study notes of English

A shift cipher involves replacing each letter in the message by a letter that is some fixed number of positions further along in the alphabet.

Typology: Study notes

2021/2022

Uploaded on 09/12/2022

melanchony
melanchony 🇬🇧

4.1

(8)

213 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Shift (Caesar) Ciphers If you have a message you want to ... and more Study notes English in PDF only on Docsity! Shift (Caesar) Ciphers If you have a message you want to transmit securely, you can encrypt it (translate it into a secret code). One of the simplest ways to do this is with a shift cipher. Famously, Julius Caesar used this type of cipher when sending messages to his military commanders. A shift cipher involves replacing each letter in the message by a letter that is some fixed number of positions further along in the alphabet. We’ll call this number the encryption key. It is just the length of the shift we are using. For example, upon encrypting the message “cookie” using a shift cipher with encryption key 3, we obtain the encoded message (or ciphertext): FRRNLH. To make all of this more mathematical, consider the following conversion table for the English alphabet: 0 1 2 3 4 5 6 7 8 9 10 11 12 A B C D E F G H I J K L M 13 14 15 16 17 18 19 20 21 22 23 24 25 N O P Q R S T U V W X Y Z i. Using the table, we can represent the letters in our message “cookie” with their corresponding numbers: 2 14 14 10 8 4. ii. Now add 3 (the encryption key) to each number to get: 5 17 17 13 11 7. iii. Now use the table to replace these numbers with their corresponding letters: FRRNLH. There is a small complication when we want to encrypt a message that contains a letter near the end of the alphabet. For example, if we consider the new message “pizza,” then what letter should we use to replace the “z” when we encrypt? After performing a shift cipher encryption with encryption key 3, the message “pizza” becomes SLCCD. The letter “z” was replaced with the letter “C,” which we can view as being 3 places further along than “z” if, after we reach “z,” we cycle the alphabet around to the beginning again. In terms of the numerical representations of our letters, the encryption of the message “pizza” looks this way: 15 8 25 25 0 −→ 18 11 2 2 3. What have we done mathematically? There is a handy mathematical concept that describes this very nicely. Define the following notation for integers a and b and integer m > 1: a ≡ b (mod m) means m is a divisor of a− b. In our situation, we take the number m (the modulus), to be equal to the size of our character set, so m = 26. Now take each number x from the representation of the message and perform the following arithmetic: add 3 to x, and if the result is between 0 and 25, stop; otherwise, replace x + 3 with the integer y between 0 and 25 that satisfies y ≡ x + 3 (mod 26). In summary, our encryption of the message “pizza” using a shift cipher with encryption key 3 looks like this: p −→ 15 −→ 15 + 3 ≡ 18 (mod 26) −→ S i −→ 8 −→ 8 + 3 ≡ 11 (mod 26) −→ L z −→ 25 −→ 25 + 3 ≡ 2 (mod 26) −→ C z −→ 25 −→ 25 + 3 ≡ 2 (mod 26) −→ C a −→ 0 −→ 0 + 3 ≡ 3 (mod 26) −→ D
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved