The Caesar Cipher Tool is a Programming Fundamentals course project written in C. It encrypts and decrypts messages by shifting alphabetic characters by a user-provided key.
It also includes a brute-force mode that prints all 25 possible non-zero shifts, allowing users to inspect possible plaintexts without knowing the key.
|
Shift alphabetic characters forward using a secret key. |
Reverse the shift to recover the original message. |
Generate all possible shifted outputs for inspection. |
The program maps each letter to a position from 0 to 25, applies a modular shift, then maps the result back to a character.
For encryption:
E(x) = (x + k) \,\bmod\, 26
For decryption:
D(x) = (x - k + 26) \,\bmod\, 26
Uppercase and lowercase letters are handled separately. Non-alphabetic characters are left unchanged.
Core concepts used
- Functions and modular program structure
- Character arrays and string handling
- ASCII character ranges
- Loops and conditional statements
- Switch-case selection
- Modular arithmetic
The source file is cc.c.
Example compilation with GCC:
gcc cc.c -o caesar_cipher
./caesar_cipherNote: The source currently includes
conio.h, which is not part of standard C and is unused in the program. On systems without that header, remove the#include <conio.h>line before compiling.
| Resource | Description |
|---|---|
| Source code | Main C implementation |
| Project proposal | Initial project proposal |
| Project report | Written project report |
| CCP presentation | Presentation slides |
| Printed report | Report printout |