TheAlgorithms / C-Plus-Plus

Collection of various algorithms in mathematics, machine learning, computer science and physics implemented in C++ for educational purposes.
https://thealgorithms.github.io/C-Plus-Plus
MIT License
30.56k stars 7.24k forks source link

[FEATURE] Add Playfair cipher in Ciphers - New Cipher #2809

Open JaydityaDhaka opened 1 week ago

JaydityaDhaka commented 1 week ago

Detailed description

The Playfair cipher is a classical encryption technique that uses a 5x5 grid to encrypt pairs of letters (digraphs) in a message. This method helps obscure the frequency analysis of individual letters, making it more secure than simple substitution ciphers. The Playfair cipher works by substituting pairs of letters based on their positions in the grid, which is constructed using a keyword or phrase.

Context

I have previously implemented the Playfair cipher for a class project. While searching for existing code online, I found a lack of accessible implementations that would aid students in understanding and utilizing this cipher for their assignments. After spending two hours writing the code from scratch, I realized the importance of sharing this knowledge. By adding my implementation to an open-source platform, I hope to assist others who may find themselves in a similar situation. It would bring me great joy to see students benefit from my work while also aiming to earn the Hacktoberfest tag for this contribution.

Possible implementation

Here’s a possible outline of how to implement the Playfair cipher:

  1. Grid Construction:
  1. Message Preparation:
  1. Encryption Logic:
  1. Decryption Logic:
  1. User Interface:

Additional information

JaydityaDhaka commented 5 days ago

Pull Request