Add decrypt function to Caesar cipher

- Implement decrypt function that reverses encryption with negative
  shift
- Export decrypt in package's public API
- Update tests with basic roundtrip and edge case tests
- Update documentation to reflect encryption/decryption support
This commit is contained in:
2026-10-04 13:18:33 +08:00
parent cdbf6396ab
commit 621f5f7272
5 changed files with 28 additions and 7 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
Each letter is moved `shift` places through the alphabet:
`new_position = (ALPHABET.index(letter) + shift) % 26`.
The modulo keeps positions in range for shifts past `z`.
Non-letters are left untouched and letter case is preserved.
Decryption is encryption with `-shift`. Non-letters are left untouched and letter case is preserved.
API reference: run `doxygen Doxyfile` from the repository root and open
`docs/doxygen/html/index.html`. The step-by-step plan is in [plan.md](plan.md).