
Understanding the Shift Cipher Method for Cryptography
Dive into the world of cryptography with a focus on the Shift Cipher method, exploring encryption, decryption, the modulo operation, examples, and cryptanalysis techniques. Learn how to encrypt and decrypt messages using a shift in alphabets and understand the intricacies of breaking the cipher through brute force or frequency analysis.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Lecture Notes for Cryptography The SADET Project Module 3 The Shift Cipher
Conventional Encryption Model Insecure channel Alice Bob x Encrypt Decrypt y x k k Secure Channel Gen Oscar Key Source 3
Shift Cipher Think Idea substitution Represent the capital letters of the English alphabet by integers Encryption ek(x) = (x + k) mod 26 Decryption dk(y) = (y k) mod 26 x, y A 0 N 13 B 1 O 14 C 2 P 15 D 3 Q 16 E 4 R 17 F 5 S 18 G 6 T 19 H 7 U 20 I 8 V 21 J 9 W 22 K 10 X 23 L M 12 Z 25 11 Y 24 4
The modulo operation What is 27 mod 5? Definition Let a, r, m be integers and let m > 0 We write a r mod m if m divides r a (or a r) and 0 r < m m is called the modulus r is called the remainder Note that r is positive or zero We can write a = m.q + r where q is another integer (quotient) 5
Examples 42 6 mod 9 9 divides 42-6 = 36 9 also divides 6-42 = -36 Note that 42 = 9 4 + 6 (q = 4) -42 3 mod 9 9 divides -42-3 = -45 9 also divides 3-(-42) = 45 Note that -42 = 9 (-5) + 3 q = -5 Be careful of the mod operation with negative numbers and how C or Java deal with them 6
Shift Cipher Continued Comments Each alphabet is shifted by k units to the right during encryption Each alphabet is shifted k units to the left during decryption There is a wrap-around if the shift results in an alphabet beyond Z Example: Consider k = 3 (also called Caesar Cipher) PLAINTEXT = 15-11-0-8-13-19-4-23-19 Encryption yields: 18-14-3-11-16-22-7-0-22 The ciphertext is SODLQWHAW Decrypt SODLWHAW 7
Cryptanalysis of the Shift Cipher Brute force search Only 25 possible useful keys Manually, at 5 minutes per key, it will take you 125 minutes (2 hours) to break the shift cipher in the worst case Possible to simplify the attack using frequency analysis The shift cipher is a substitution Each alphabet is mapped to exactly one other alphabet Say we map A to Q The frequency of occurrence of the alphabet A in the plaintext must match the frequency of occurrence of the alphabet Q in the ciphertext 8
Frequencies of occurrence of letters in English 0.14 0.12 0.1 0.08 0.06 0.04 0.02 0 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 9
Example: Ciphertext: BJKNWXYHTSXNIJWYMJBJFPJXYYDUJTKFYYFHP Do a frequency analysis: A-0, B-2, C-0, D-1, E-0, F-3, G-0, H-2, I-1, J-6, K-2, L-0, M-1, N-2, O-0, P-2, Q-0, R-0, S-1, T-2, U-1, V-0, W-2, X-3, Y-6, Z-0 Most common letters are J occurs 6 times Y occurs 6 times Do the cryptanalysis 10