1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! # Caesar Cipher Module
//!
//! This module provides an implementation of the classical **Caesar cipher**,
//! one of the simplest and most well-known substitution ciphers.
//!
//! # Overview
//!
//! The Caesar cipher works by shifting each character in the plaintext
//! by a fixed number of positions in the alphabet.
//!
//! ```text
//! E(x) = (x + k) mod n
//! D(x) = (x - k) mod n
//! ```
//!
//! where:
//! - `x` = character index
//! - `k` = shift (key)
//! - `n` = size of the alphabet
//!
//! # Components
//!
//! - [`encrypt`] - Applies a forward shift to produce ciphertext.
//! - [`decrypt`] - Applies the inverse shift to recover plaintext.
//!
//! # Example
//!
//! ```text
//! Plaintext: HELLO
//! Shift (k): 3
//! Ciphertext: KHOOR
//! ```
//!
//! # ⚠️ Security Warning
//!
//! The Caesar cipher is **not secure** and should never be used in real-world applications.
//!
//! It is vulnerable to:
//!
//! - Brute-force attacks (only `n` possible keys)
//! - Frequency analysis
//!
//! # Use Cases
//!
//! - Learning basic cryptography concepts
//! - Understanding modular arithmetic
//! - Educational demonstrations
//!
//! # Notes
//!
//! - Typically operates on ASCII or alphabetic characters.
//! - Behavior depends on how non-alphabetic characters are handled.