Classical Cryptography
Caesar Cipher
The Caesar Cipher is one of the simplest and oldest substitution ciphers. Each letter of the plaintext is shifted by a fixed number of positions.
Algorithm Steps
- 1Take plaintext input.
- 2Take shift key input.
- 3Convert each alphabetic character to its numeric position.
- 4Shift each character by the key.
- 5Apply modulo 26.
- 6Convert numbers back to letters.
Formula
Encryption: C = (P + K) mod 26 Decryption: P = (C - K) mod 26
Example
Plaintext: HELLO Key: 3 Encrypted text: KHOOR Decrypted text: HELLO