Skip to content

[FEATURE REQUEST] Add PermutationCipher implementation and tests #6697

@Chinmayeep58

Description

@Chinmayeep58

What would you like to Propose?

Add a new cipher implementation- PermutationCipher.java, along with unit tests.
I propose adding a Permutation Cipher class that performs encryption and decryption by rearranging characters of plaintext according to a fixed permutation key. This cipher is a simple transposition cipher useful for demonstrating permutation-based encryption logic.
The implementation will include:

PermutationCipher.java: core class implementing encrypt/decrypt methods.

PermutationCipherTest.java: JUnit 5 test cases to verify correctness.

Issue details

Implement a cipher that encrypts text by rearranging the positions of letters based on a key permutation. For example, using key {3, 1, 2}, plaintext "HELLO" is divided into blocks of 3, and letters are permuted to produce ciphertext.
Enhancements Proposed:

  1. Add PermutationCipher.java implementing the algorithm.
  2. Add PermutationCipherTest.java with unit tests for encryption/decryption.
  3. Include padding for incomplete blocks.

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions