Skip to content

Conversation

@Dhvani365
Copy link

Added Playfair cipher (JavaScript) in Cryptography Algorithms

What:
Adds implementation of the Playfair cipher in JavaScript, including encrypt and decrypt functions. Includes README explanation and unit tests.

Why:
The repository already includes classical ciphers (Caesar, Rail-Fence, Hill). The Playfair cipher is a historically important digraph substitution cipher and completes this cryptography section.

How:

  • playfairCipher.js contains the core logic (Key matrix creation, pair creation, pairwise encryption and decryption)
  • README.md explains the algorithm, how to use the code and sample input/output
  • playfairCipher.test.js includes tests for typical and edge cases

Testing:
Run npm test — all tests should pass, including new ones.

Checklist:

  • Code follows the style of existing algorithms in the repo
  • Explanations/documentation added
  • Tests added and passing
  • No breaking changes

@lazarljubenovic
Copy link

What's the point of submitting it here when we can all generate it the same way you did?

@Dhvani365
Copy link
Author

Dhvani365 commented Oct 23, 2025

What's the point of submitting it here when we can all generate it the same way you did?

Implementing code is different thing, but learning from this is an important thing. As part of my learning, I wanted to implement some of the standard algorithms in javascript (this is one of them). This PR if merged with javascript-algorithms repository shows my learning and contribution as well as motivates beginners to implement such standard algorithms in javascript and contribute!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants