๐Ÿ” Caesar Cipher โ€” Class Notes

High school-friendly notes on substitution ciphers, encryption, decryption, and simple algorithms.

Cryptography Basics Encryption / Decryption Modular Arithmetic Beginner Algorithms

๐ŸŽฏ Learning Objectives

  • Understand what a Caesar Cipher is
  • Explain encryption vs decryption
  • Apply a shift cipher manually
  • Write a basic Caesar Cipher algorithm
  • Recognize strengths and weaknesses of simple encryption

๐Ÿง  What is a Caesar Cipher?

A Caesar Cipher is one of the oldest and simplest encryption techniques. It is a type of substitution cipher.

Key Idea: Each letter is shifted a certain number of places down the alphabet.
A โ†’ D
B โ†’ E
C โ†’ F

๐Ÿ“œ History

  • Named after Julius Caesar
  • Used to send secret military messages
  • Simple but important in the history of cryptography

๐Ÿ”‘ Key Vocabulary

Encryption

Turning readable text into secret code.

HELLO โ†’ KHOOR

Decryption

Turning coded text back into readable text.

KHOOR โ†’ HELLO

Plaintext

Original readable message.

Ciphertext

Encrypted (hidden) message.

Shift (Key)

Number of letters moved forward or backward.

๐Ÿ”„ How the Caesar Cipher Works

Step 1 โ€” Choose a Shift Value

Shift = 3

Step 2 โ€” Shift the Alphabet

Alphabet:

ABCDEFGHIJKLMNOPQRSTUVWXYZ

Shifted by 3:

DEFGHIJKLMNOPQRSTUVWXYZABC

Step 3 โ€” Replace Letters

Example: encrypt HELLO with shift 3

H โ†’ K
E โ†’ H
L โ†’ O
L โ†’ O
O โ†’ R

Encrypted = KHOOR

๐Ÿ” Wrap Around Rule

When shifting past Z, wrap back to A.

Z + 3 = C
Y + 3 = B

โœ๏ธ Manual Practice Example

Encrypt DOG with shift 1:

D โ†’ E
O โ†’ P
G โ†’ H

Encrypted = EPH

๐Ÿ’ป Algorithm (Simple Steps)

Encryption Algorithm

  1. Read message
  2. Choose shift value
  3. For each letter:
    • Convert to alphabet position
    • Add shift
    • Wrap around if needed
  4. Convert back to letter
  5. Display encrypted text

๐Ÿ‘จโ€๐Ÿ’ป Java Logic Concept (High-Level)

This formula shifts uppercase letters and wraps using modulo:

char shifted = (char)((original - 'A' + shift) % 26 + 'A');
Why it works: Convert letter โ†’ number, add shift, use % 26 to wrap, convert back.

๐Ÿ”“ Decryption

Decryption shifts letters backwards.

decryptShift = 26 - shift

Or simply subtract shift instead of adding.

๐Ÿ” Strengths

  • Easy to understand
  • Good introduction to cryptography
  • Helps learn algorithms and modular arithmetic

โš ๏ธ Weaknesses

  • Very easy to break
  • Only 25 possible shifts
  • Vulnerable to brute-force attacks
Important: Caesar Cipher is educational, not secure.

๐Ÿงช Real Cybersecurity Connection

Modern encryption uses:

  • Complex math
  • Large keys
  • Algorithms like AES or RSA
Caesar Cipher is considered educational, not secure.

๐Ÿ“Š Example Table

Plain Shift Cipher
A+3D
B+3E
C+3F

๐Ÿงฉ Challenge Question

If Encrypted = ZRUOG and Shift = 3, what is the original message?