feat(ciphers): Add PermutationCipher implementation(enhance #6697) (#6700)
* feat(ciphers): Add PermutationCipher implementation with comprehensive tests - Implement PermutationCipher class for transposition encryption/decryption - Add encrypt() and decrypt() methods with permutation key support - Include robust key validation (1-based positions, no duplicates) - Implement automatic padding for incomplete blocks using 'X' character - Add comprehensive error handling with descriptive exceptions - Create 20+ JUnit test cases covering encryption, decryption, edge cases - Support various key sizes and text processing (spaces removal, case handling) - Include detailed JavaDoc documentation with algorithm explanation Algorithm Details: - Divides plaintext into blocks based on key length - Rearranges characters within each block according to permutation positions - Supports round-trip encryption/decryption with inverse permutation - Handles edge cases: empty strings, single character keys, padding Tests include: basic functionality, different key sizes, error validation, real-world examples, and edge case handling. * Run PermutationCipherTest using Maven * refactor(PermutationCipher): clean up code by removing unnecessary whitespace and comments * fix(tests): remove unnecessary whitespace in test assertion for encryption * fix(tests): correct indentation in assertion for encryption verification --------- Co-authored-by: a <alexanderklmn@gmail.com>
D
Dheeraj Kumar committed
c06dc292fe1de8158aab283d7496e094d463a46b
Parent: 74647e3
Committed by GitHub <noreply@github.com>
on 10/8/2025, 6:42:58 AM