Commit Graph

66 Commits

Author SHA1 Message Date
Lê Nam Khánh
147da38888 chore: fix typos in src/main/java/com/thealgorithms/ciphers/AES.java (#7047)
Fix typos in src/main/java/com/thealgorithms/ciphers/AES.java

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2025-11-05 15:45:27 +00:00
Dheeraj Kumar
c06dc292fe 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>
2025-10-08 08:42:58 +02:00
Piotr Idzik
27a774020c style: include SLS_SUSPICIOUS_LOOP_SEARCH (#6260) 2025-06-04 23:37:38 +03:00
Piotr Idzik
0072ed9aa7 style: do not suppress lossy-conversions (#6206) 2025-03-31 19:20:58 +02:00
Strange Developer
df0c997e4b General performance improvement (#6078) 2024-11-01 19:52:42 +02:00
Hardik Pawar
8b604858f5 Enhance docs, add more tests in Vigenere (#5899) 2024-10-26 18:50:31 +00:00
Hardik Pawar
08bd1ffe73 Refactor AtbashCipher, add ParameterizedTest (#5808) 2024-10-26 15:33:33 +00:00
Hardik Pawar
4e46002103 Enhance docs, add more tests in XORCipher (#5900) 2024-10-26 18:07:47 +03:00
Hardik Pawar
4d85c61c37 Enhance docs, add more tests in RSA (#5898) 2024-10-26 14:50:32 +00:00
Hardik Pawar
3de202b953 Enhance docs, add more tests in ADFGVXCipher (#5897) 2024-10-26 14:46:02 +00:00
Benjamin Burstein
87030aff1e Add BaconianCipher (#5932) 2024-10-22 18:30:37 +00:00
Ritisha Pande
c56d282ae0 Add DiffieHellman and MonoAlphabetic (#5508) 2024-10-22 18:16:35 +00:00
Varnan Rathod
b35f98a67a Add Rail Fence Cipher (#5761) 2024-10-15 18:23:10 +03:00
Benjamin Burstein
f8397bf09b Add ADFGVX Cipher (#5631) 2024-10-12 10:34:49 +03:00
Varnan Rathod
2338428578 Add cipher class, cipher tests, enhance docs in 'AtbashCipher.java' (#5690) 2024-10-11 06:05:26 +00:00
xuyang471
2040df88d9 Add Elliptic Curve Cryptography (#5700) 2024-10-11 05:47:36 +00:00
SAIVARDHAN15
6e6028e3d0 Fix columnarTranspositionCipher and typos in Test (#5649) 2024-10-09 22:41:25 +03:00
Hardik Pawar
25dc55e4ae Add Junit tests for ColumnarTranspositionCipher.java (#5599) 2024-10-07 15:11:56 +00:00
Hardik Pawar
f80850b244 Add Junit tests for AffineCipher.java, improve documentation (#5598) 2024-10-07 18:08:55 +03:00
Hardik Pawar
26e8ead4ed Add tests for A5Cipher.java, improve class & function documentation (#5594) 2024-10-07 14:28:01 +00:00
Hardik Pawar
93cfa86a97 Add tests for A5KeyStreamGenerator.java, improve documentation (#5595) 2024-10-07 14:23:21 +00:00
Hardik Pawar
ee6cd648bc Strengthen class & function documentation in CompositeLFSR.java (#5596)
Co-authored-by: Alex Klymenko <alexanderklmn@gmail.com>
2024-10-06 20:12:57 +02:00
Benjamin Burstein
07cb6c46a8 Add autokey cipher (#5569) 2024-10-06 05:37:56 +00:00
Benjamin Burstein
393337fa8e Add Tests for HillCipher (#5562) 2024-10-04 17:18:51 +00:00
Luiz Carlos Jr
41f767ef94 Add XOR Cipher (#5490) 2024-10-04 16:10:18 +00:00
Samuel Facchinello
87b17e0571 style: enable NeedBraces in checkstyle (#5227)
* enable style NeedBraces

* style: enable NeedBraces in checkstyle

---------

Co-authored-by: Samuel Facchinello <samuel.facchinello@piksel.com>
2024-06-13 21:00:16 +02:00
StarDxxx
be38886d43 style: enable OperatorWrap in checkstyle (#5212) 2024-06-08 09:36:42 +02:00
S. Utkarsh
a6e873deef style: enable MemberName in checkstyle (#5193)
* style: enable MemberName in checkstyle

* style: simply uncomment `MemberName`

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-05-29 20:44:14 +00:00
S. Utkarsh
25d711c5d8 style: enable LocalVariableName in CheckStyle (#5191)
* style: enable LocalVariableName in checkstyle

* Removed minor bug

* Resolved Method Name Bug

* Changed names according to suggestions
2024-05-28 20:29:28 +02:00
Piotr Idzik
70c1d97ab1 style: include SPP_TOSTRING_ON_STRING (#5183) 2024-05-28 02:37:20 +05:30
Godwill Christopher
295e7436b1 style: enable MethodName in CheckStyle (#5182)
enabled: MethodName in CheckStyle
2024-05-27 09:06:06 +02:00
Piotr Idzik
ea4dc15a24 style: do not suppress try (#5167) 2024-05-27 03:02:36 +05:30
vaibhav9t1
9eaa2bb756 style: enable MultipleVariableDeclarations in checkstyle (#5175)
Co-authored-by: vaibhav <vaibhav.waghmare@techprescient.com>
2024-05-25 20:18:27 +02:00
vaibhav9t1
44ce6e7b0d style: enable StaticVariableName in checkstyle (#5173)
* style: enable StaticVariableName in checkstyle

* Refractored: enable StaticVariableName in checkstyle

* style: mark more variables as `final`

---------

Co-authored-by: vaibhav <vaibhav.waghmare@techprescient.com>
Co-authored-by: vil02 <vil02@o2.pl>
2024-05-25 14:09:14 +00:00
Piotr Idzik
8be8b953ab style: do not suppress this-escape (#5166) 2024-05-20 16:09:23 +00:00
Godwill Christopher
0f42e995a4 style: enabled InnerAssignment in checkstyle (#5162)
* style: enabled InnerAssignment in checkstyle

* Refactor code formatting in KnapsackMemoization.java and UnionFind.java

* style: remove redundant blank line

* style: mark `includeCurrentItem` and `excludeCurrentItem` as `final`

* style: remove `KnapsackMemoization` from `pmd-exclude.properties`

* style: use `final`

---------

Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
2024-05-16 16:46:03 +00:00
Piotr Idzik
52f15b2b08 style: include RV_RETURN_VALUE_IGNORED (#5152) 2024-05-09 15:23:22 +00:00
Piotr Idzik
d2ddec55e5 style: include NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION (#5149)
* style: use `assertFalse` and `assertTrue`

* style: include `NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION`
2024-05-08 22:41:46 +05:30
Piotr Idzik
d3bb691f59 style: enable HideUtilityClassConstructor in checkstyle (#5147) 2024-05-08 09:58:29 +03:00
Piotr Idzik
bfb27eeb59 style: enable ArrayTypeStyle in checkstyle (#5145) 2024-05-06 22:49:52 +03:00
Piotr Idzik
414835db11 style: enable AvoidStarImport in checkstyle (#5141) 2024-05-05 20:48:56 +02:00
marysiuniq
1e2d7e9431 style: enable ConstantName in checkstyle (#5139)
Co-authored-by: Maria Paszkiewicz SCC <maria.paszkiewicz@kit.edu>
2024-05-02 18:31:37 +02:00
SOZEL
ab371843ac Close Scanner to avoid resource leak (#5077) 2024-03-12 19:49:58 +01:00
Govind Gupta
9bef5a169c Add Playfair Cipher (#4988) 2024-01-03 15:14:38 +02:00
aryan1165
7ece806cf5 Remove duplicate file of Simple Substitution Cipher (fixes #4494) (#4495) 2023-12-26 00:24:28 +02:00
Ayoub Chegraoui
8002137b76 Fixed some typos and links for javadoc, and some refactoring (#4755) 2023-10-15 19:32:24 +05:30
acbin
415a04ea7f Add automatic linter (#4214) 2023-06-09 20:05:14 +08:00
acbin
00282efd8b style: format code (#4212)
close #4204
2023-06-09 18:52:05 +08:00
Aditya Pal
fb18c27905 Add wiki link for DES (#4173) 2023-04-30 22:22:19 +03:00
Aditya Pal
19bd2408ff Des (#4172)
* Update directory

* Add DES Encryption algorithm

* Update directory

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-04-30 20:19:14 +05:30