C-Plus-Plus
C-Plus-Plus copied to clipboard
Feat: Add playfair cipher
Description of Change
This pull request adds the implementation of the Playfair Cipher algorithm. The Playfair cipher is a digraph substitution cipher, which encrypts pairs of letters from the plaintext using a 5x5 grid. It provides both encryption and decryption functions, handling edge cases such as repeated letters and handling of the 'j' character by replacing it with 'i'.
Key Features:
- Implementation of the encryption and decryption methods.
- A utility to clean input strings by removing non-alphabet characters and converting the text to lowercase.
- Generation of the Playfair 5x5 grid based on a provided key.
- Supports formatted digraphs and insertion of 'x' for repeated characters and padding.
Checklist
[x] Added description of change [x] Added file name matches File name guidelines [x] Added tests and example, test must pass [x] Added documentation so that the program is self-explanatory and educational - Doxygen guidelines [x] Relevant documentation/comments is changed or added [x] PR title follows semantic commit guidelines [x] Search previous suggestions before making a new one, as yours may be a duplicate. [x] I acknowledge that all my contributions will be made under the project's license.
Notes: This pull request includes a detailed file header using Doxygen-style comments, an example of usage with both encryption and decryption of sample text, and test cases to ensure the correctness of the algorithm.