Caesar Cipher

Written by

in

The Caesar Cipher is one of the earliest, simplest, and most widely known symmetric encryption techniques in history. It is a type of substitution cipher where each letter in the original message (plaintext) is replaced by another letter located a fixed number of positions further down the alphabet. How It Works

To use the cipher, you must choose a “shift” value (or key) between 1 and 25. This key determines how many spaces each letter moves down the alphabet. If the shift goes past the letter “Z”, it simply wraps around back to the beginning of the alphabet (“A”). Encryption: Shift the letters forward.

Decryption: Shift the letters backward by the same number to reverse the process. Mathematical Formula

If you assign numbers to letters (A = 0, B = 1, C = 2, …, Z = 25), the cipher can be calculated using modular arithmetic:

Encryption: C=(P+K)(mod26)Encryption: cap C equals open paren cap P plus cap K close paren space open paren mod space 26 close paren

Decryption: P=(C−K)(mod26)Decryption: cap P equals open paren cap C minus cap K close paren space open paren mod space 26 close paren

(Where P is the plaintext letter, C is the ciphertext letter, and K is the shift key.) Visual Example (Shift of 3)

Julius Caesar famously utilized a shift of 3 for his communications. With this key, the alphabet aligns like this: Ciphertext D E F G H I A B C Plaintext: SECRET MESSAGE Ciphertext: VHFUHW PHVVDJH History and Significance

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *