Fix build warnings
This commit is contained in:
19
pom.xml
19
pom.xml
@@ -45,6 +45,8 @@
|
||||
<sonar.java.source>25</sonar.java.source>
|
||||
<sonar.dependencyCheck.jsonReportPath>target/dependency-check-report.json</sonar.dependencyCheck.jsonReportPath>
|
||||
<sonar.dependencyCheck.htmlReportPath>target/dependency-check-report.html</sonar.dependencyCheck.htmlReportPath>
|
||||
|
||||
<argLine></argLine>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -119,6 +121,19 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.9.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>properties</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!--Sonarqube-->
|
||||
<plugin>
|
||||
<groupId>org.owasp</groupId>
|
||||
@@ -206,6 +221,7 @@
|
||||
<release>${java.version}</release>
|
||||
<compilerArgs>
|
||||
<arg>-Xlint:all</arg>
|
||||
<arg>-Xlint:-serial</arg>
|
||||
</compilerArgs>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
@@ -215,6 +231,9 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.5.4</version>
|
||||
<configuration>
|
||||
<argLine>@{argLine} -javaagent:${org.mockito:mockito-core:jar}</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/combination/ADFGVX.java
|
||||
//Mattrixwv
|
||||
// Created: 01-26-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.combination;
|
||||
|
||||
|
||||
@@ -43,7 +23,7 @@ import com.mattrixwv.cipherstream.polysubstitution.LargePolybiusSquare;
|
||||
* <li>Encoding/decoding with a columnar transposition cipher (Columnar)</li>
|
||||
* </ol>
|
||||
*/
|
||||
public class ADFGVX{
|
||||
public final class ADFGVX{
|
||||
private static final Logger logger = LoggerFactory.getLogger(ADFGVX.class);
|
||||
//?Fields
|
||||
/** The string that needs encoded/decoded */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/combination/ADFGX.java
|
||||
//Mattrixwv
|
||||
// Created: 01-25-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.combination;
|
||||
|
||||
|
||||
@@ -43,7 +23,7 @@ import com.mattrixwv.cipherstream.polysubstitution.PolybiusSquare;
|
||||
* <li>Encoding/decoding with a columnar transposition cipher (Columnar)</li>
|
||||
* </ol>
|
||||
*/
|
||||
public class ADFGX{
|
||||
public final class ADFGX{
|
||||
private static final Logger logger = LoggerFactory.getLogger(ADFGX.class);
|
||||
|
||||
//?Internal fields
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Affine.java
|
||||
//Mattrixwv
|
||||
// Created: 01-26-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.monosubstitution;
|
||||
|
||||
|
||||
@@ -41,7 +21,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||
* <li><strong>Key2</strong>: The additive key</li>
|
||||
* </ul>
|
||||
*/
|
||||
public class Affine{
|
||||
public final class Affine{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Affine.class);
|
||||
//?Fields
|
||||
/** The string that needs encoded/decoded */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Atbash.java
|
||||
//Mattrixwv
|
||||
// Created: 07-25-21
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.monosubstitution;
|
||||
|
||||
|
||||
@@ -36,7 +16,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||
* The Atbash cipher is symmetric, meaning that encoding and decoding are the same operation.
|
||||
* </p>
|
||||
*/
|
||||
public class Atbash{
|
||||
public final class Atbash{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Atbash.class);
|
||||
//?Fields
|
||||
/** Holds the string that needs encoded or decoded */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/test/java/com/mattrixwv/CipherStreamJava/Baconian.java
|
||||
//Mattrixwv
|
||||
// Created: 01-12-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.monosubstitution;
|
||||
|
||||
|
||||
@@ -41,7 +21,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||
* and sequences are converted back to letters for decoding.
|
||||
* </p>
|
||||
*/
|
||||
public class Baconian{
|
||||
public final class Baconian{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Baconian.class);
|
||||
|
||||
//?Conversions
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/BaseX.java
|
||||
//Mattrixwv
|
||||
// Created: 01-08-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.monosubstitution;
|
||||
|
||||
|
||||
@@ -42,7 +22,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||
* for the specified base.
|
||||
* </p>
|
||||
*/
|
||||
public class BaseX{
|
||||
public final class BaseX{
|
||||
private static final Logger logger = LoggerFactory.getLogger(BaseX.class);
|
||||
//?Fields
|
||||
/** The string that needs encoded/decoded */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Beaufort.java
|
||||
//Mattrixwv
|
||||
// Created: 02-23-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.monosubstitution;
|
||||
|
||||
|
||||
@@ -43,7 +23,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||
* This class allows you to encode and decode strings with options to preserve
|
||||
* capitalization, whitespace, and symbols.
|
||||
*/
|
||||
public class Beaufort{
|
||||
public final class Beaufort{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Beaufort.class);
|
||||
//?Fields
|
||||
/** This is the string that needs encoded/decoded */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Caesar.java
|
||||
//Matthew Ellison
|
||||
// Created: 07-25-21
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.monosubstitution;
|
||||
|
||||
|
||||
@@ -37,7 +17,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||
* capitalization, whitespace, and symbols.
|
||||
* </p>
|
||||
*/
|
||||
public class Caesar{
|
||||
public final class Caesar{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Caesar.class);
|
||||
//?Fields
|
||||
/** The string that needs encoded/decoded */
|
||||
@@ -120,7 +100,7 @@ public class Caesar{
|
||||
if(Character.isUpperCase(currentChar)){
|
||||
logger.debug("Encoding uppercase");
|
||||
|
||||
currentChar += shift;
|
||||
currentChar = (char)((int)currentChar + shift);
|
||||
//Wrap around if the letter is now out of bounds
|
||||
if(currentChar < 'A'){
|
||||
logger.debug("Wrapping around to Z");
|
||||
@@ -135,7 +115,7 @@ public class Caesar{
|
||||
else if(Character.isLowerCase(currentChar)){
|
||||
logger.debug("Encoding lowercase");
|
||||
|
||||
currentChar += shift;
|
||||
currentChar = (char)((int)currentChar + shift);
|
||||
//Wrap around if the letter is now out of bounds
|
||||
if(currentChar < 'a'){
|
||||
logger.debug("Wrapping around to z");
|
||||
@@ -170,7 +150,7 @@ public class Caesar{
|
||||
if(Character.isUpperCase(currentChar)){
|
||||
logger.debug("Decoding uppercase");
|
||||
|
||||
currentChar -= shift;
|
||||
currentChar = (char)((int)currentChar - shift);
|
||||
//Wrap around if the letter is now out of bounds
|
||||
if(currentChar < 'A'){
|
||||
logger.debug("Wrapping around to Z");
|
||||
@@ -187,7 +167,7 @@ public class Caesar{
|
||||
else if(Character.isLowerCase(currentChar)){
|
||||
logger.debug("Decoding lowercase");
|
||||
|
||||
currentChar -= shift;
|
||||
currentChar = (char)((int)currentChar - shift);
|
||||
//Wrap around if the letter is now out of bounds
|
||||
if(currentChar < 'a'){
|
||||
logger.debug("Wrapping around to z");
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Porta.java
|
||||
//Mattrixwv
|
||||
// Created: 02-28-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.monosubstitution;
|
||||
|
||||
|
||||
@@ -40,7 +20,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||
* certain characters based on configuration settings.
|
||||
* </p>
|
||||
*/
|
||||
public class Porta{
|
||||
public final class Porta{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Porta.class);
|
||||
|
||||
/** Predefined alphabetic tableau used for encoding and decoding */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Substitution.java
|
||||
//Mattrixwv
|
||||
// Created: 02-22-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.monosubstitution;
|
||||
|
||||
|
||||
@@ -39,7 +19,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||
* of the alphabet and optionally digits, without duplicates.
|
||||
* </p>
|
||||
*/
|
||||
public class Substitution{
|
||||
public final class Substitution{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Substitution.class);
|
||||
//?Fields
|
||||
/** The string that needs encoded/decoded */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/monosubstitution/Vigenere.java
|
||||
//Matthew Ellison
|
||||
// Created: 07-25-21
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.monosubstitution;
|
||||
|
||||
|
||||
@@ -248,7 +228,10 @@ public class Vigenere{
|
||||
*/
|
||||
public Vigenere(){
|
||||
offset = new ArrayList<>();
|
||||
reset();
|
||||
inputString = "";
|
||||
outputString = "";
|
||||
keyword = "";
|
||||
offset.clear();
|
||||
preserveCapitals = false;
|
||||
preserveWhitespace = false;
|
||||
preserveSymbols = false;
|
||||
@@ -262,7 +245,10 @@ public class Vigenere{
|
||||
*/
|
||||
public Vigenere(boolean preserveCapitals, boolean preserveWhitespace, boolean preserveSymbols){
|
||||
offset = new ArrayList<>();
|
||||
reset();
|
||||
inputString = "";
|
||||
outputString = "";
|
||||
keyword = "";
|
||||
offset.clear();
|
||||
this.preserveCapitals = preserveCapitals;
|
||||
this.preserveWhitespace = preserveWhitespace;
|
||||
this.preserveSymbols = preserveSymbols;
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Bifid.java
|
||||
//Mattrixwv
|
||||
// Created: 03-03-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.polysubstitution;
|
||||
|
||||
|
||||
@@ -40,7 +20,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||
* them back into text.
|
||||
* </p>
|
||||
*/
|
||||
public class Bifid{
|
||||
public final class Bifid{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Bifid.class);
|
||||
//?Fields
|
||||
/** The message that needs to be encoded/decoded */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//MattrixwvWebsite/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Columnar.java
|
||||
//Mattrixwv
|
||||
// Created: 01-16-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.polysubstitution;
|
||||
|
||||
|
||||
@@ -43,7 +23,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||
* It also includes options to preserve capitalization, whitespace, symbols, and to handle padding characters.
|
||||
* </p>
|
||||
*/
|
||||
public class Columnar{
|
||||
public final class Columnar{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Columnar.class);
|
||||
//?Fields
|
||||
/** The message that needs to be encoded/decoded */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Hill.java
|
||||
//Mattrixwv
|
||||
// Created: 01-31-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.polysubstitution;
|
||||
|
||||
|
||||
@@ -41,7 +21,7 @@ import com.mattrixwv.matrix.exceptions.InvalidScalarException;
|
||||
* messages. It operates on blocks of text by representing them as vectors and applying matrix transformations.
|
||||
* </p>
|
||||
*/
|
||||
public class Hill{
|
||||
public final class Hill{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Hill.class);
|
||||
//?Fields
|
||||
/** The message that needs to be encoded/decoded */
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||
* The Polybius square cipher is a classical encryption method that uses a 6x6 grid
|
||||
* to encode and decode messages based on the positions of letters and numbers in the grid.
|
||||
*/
|
||||
public class LargePolybiusSquare extends PolybiusSquare{
|
||||
public final class LargePolybiusSquare extends PolybiusSquare{
|
||||
private static final Logger logger = LoggerFactory.getLogger(LargePolybiusSquare.class);
|
||||
|
||||
|
||||
@@ -239,6 +239,7 @@ public class LargePolybiusSquare extends PolybiusSquare{
|
||||
*/
|
||||
public LargePolybiusSquare() throws InvalidCharacterException{
|
||||
super();
|
||||
reset();
|
||||
}
|
||||
/**
|
||||
* Constructs a PolybiusSquare cipher instance with specified settings.
|
||||
@@ -249,5 +250,6 @@ public class LargePolybiusSquare extends PolybiusSquare{
|
||||
*/
|
||||
public LargePolybiusSquare(boolean preserveWhitespace, boolean preserveSymbols) throws InvalidCharacterException{
|
||||
super(preserveWhitespace, preserveSymbols);
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/Morse.java
|
||||
//Mattrixwv
|
||||
// Created: 07-28-21
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.polysubstitution;
|
||||
|
||||
|
||||
@@ -38,7 +18,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||
* It supports alphanumeric characters (A-Z, 0-9) and validates input to ensure it contains valid characters.
|
||||
* </p>
|
||||
*/
|
||||
public class Morse{
|
||||
public final class Morse{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Morse.class);
|
||||
//?Code representations
|
||||
/** Morse code representations for letters A-Z */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Playfair.java
|
||||
//Matthew Ellison
|
||||
// Created: 07-30-21
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.polysubstitution;
|
||||
|
||||
|
||||
@@ -35,7 +15,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||
* Represents the Playfair cipher encryption and decryption.
|
||||
* The Playfair cipher is a digraph substitution cipher that encrypts pairs of letters.
|
||||
*/
|
||||
public class Playfair{
|
||||
public final class Playfair{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Playfair.class);
|
||||
|
||||
/** A class representing the location of a character in the grid */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/PolybiusSquare.java
|
||||
//Mattrixwv
|
||||
// Created: 01-04-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.polysubstitution;
|
||||
|
||||
|
||||
@@ -94,14 +74,14 @@ public class PolybiusSquare{
|
||||
|
||||
|
||||
/**
|
||||
* Sets the replaced character.
|
||||
* Validates the Replaced character.
|
||||
*
|
||||
* @param replaced the character to be replaced
|
||||
* @param replaced the character to be validated
|
||||
* @throws InvalidCharacterException if the character is not a letter or is invalid
|
||||
* @return the validated character
|
||||
*/
|
||||
protected void setReplaced(char replaced) throws InvalidCharacterException{
|
||||
logger.debug("Setting replaced");
|
||||
logger.debug("Original character {}", replaced);
|
||||
private char validateReplaced(char replaced) throws InvalidCharacterException{
|
||||
logger.debug("Validating replaced character {}", replaced);
|
||||
|
||||
if(!Character.isAlphabetic(replaced)){
|
||||
throw new InvalidCharacterException("The replaced character must be a letter");
|
||||
@@ -112,18 +92,30 @@ public class PolybiusSquare{
|
||||
throw new InvalidCharacterException("The replaced letter cannot be the same as the replacing letter");
|
||||
}
|
||||
|
||||
this.replaced = Character.toUpperCase(replaced);
|
||||
logger.debug("Cleaned character {}", this.replaced);
|
||||
replaced = Character.toUpperCase(replaced);
|
||||
logger.debug("Cleaned character {}", replaced);
|
||||
return replaced;
|
||||
}
|
||||
/**
|
||||
* Sets the replacer character.
|
||||
* Sets the replaced character.
|
||||
*
|
||||
* @param replacer the character the replaces replaced
|
||||
* @param replaced the character to be replaced
|
||||
* @throws InvalidCharacterException if the character is not a letter or is invalid
|
||||
*/
|
||||
protected void setReplacer(char replacer) throws InvalidCharacterException{
|
||||
logger.debug("Setting replacer");
|
||||
logger.debug("Original character {}", replacer);
|
||||
protected void setReplaced(char replaced) throws InvalidCharacterException{
|
||||
logger.debug("Setting replaced");
|
||||
|
||||
this.replaced = validateReplaced(replaced);
|
||||
}
|
||||
/**
|
||||
* Validates the Replacer character.
|
||||
*
|
||||
* @param replacer the character to be validated
|
||||
* @throws InvalidCharacterException if the character is not a letter or is invalid
|
||||
* @return the validated character
|
||||
*/
|
||||
private char validateReplacer(char replacer) throws InvalidCharacterException{
|
||||
logger.debug("Validating replacer character {}", replacer);
|
||||
|
||||
if(!Character.isAlphabetic(replacer)){
|
||||
throw new InvalidCharacterException("The replacer character must be a letter");
|
||||
@@ -134,8 +126,20 @@ public class PolybiusSquare{
|
||||
throw new InvalidCharacterException("The replacer letter cannot be the same as the replaced letter");
|
||||
}
|
||||
|
||||
this.replacer = Character.toUpperCase(replacer);
|
||||
logger.debug("Cleaned character {}", this.replacer);
|
||||
replacer = Character.toUpperCase(replacer);
|
||||
logger.debug("Cleaned character {}", replacer);
|
||||
return replacer;
|
||||
}
|
||||
/**
|
||||
* Sets the replacer character.
|
||||
*
|
||||
* @param replacer the character the replaces replaced
|
||||
* @throws InvalidCharacterException if the character is not a letter or is invalid
|
||||
*/
|
||||
protected void setReplacer(char replacer) throws InvalidCharacterException{
|
||||
logger.debug("Setting replacer");
|
||||
|
||||
this.replacer = validateReplacer(replacer);
|
||||
}
|
||||
/**
|
||||
* Creates the grid from the keyword.
|
||||
@@ -478,9 +482,12 @@ public class PolybiusSquare{
|
||||
* @throws InvalidCharacterException if default characters are invalid
|
||||
*/
|
||||
public PolybiusSquare() throws InvalidCharacterException{
|
||||
reset();
|
||||
setReplaced('J');
|
||||
setReplacer('I');
|
||||
grid = new char[5][5];
|
||||
inputString = "";
|
||||
outputString = "";
|
||||
keyword = "";
|
||||
this.replaced = validateReplaced('J');
|
||||
this.replacer = validateReplacer('I');
|
||||
preserveWhitespace = false;
|
||||
preserveSymbols = false;
|
||||
}
|
||||
@@ -492,9 +499,12 @@ public class PolybiusSquare{
|
||||
* @throws InvalidCharacterException if default characters are invalid
|
||||
*/
|
||||
public PolybiusSquare(boolean preserveWhitespace, boolean preserveSymbols) throws InvalidCharacterException{
|
||||
reset();
|
||||
setReplaced('J');
|
||||
setReplacer('I');
|
||||
grid = new char[5][5];
|
||||
inputString = "";
|
||||
outputString = "";
|
||||
keyword = "";
|
||||
this.replaced = validateReplaced('J');
|
||||
this.replacer = validateReplacer('I');
|
||||
this.preserveWhitespace = preserveWhitespace;
|
||||
this.preserveSymbols = preserveSymbols;
|
||||
}
|
||||
@@ -508,9 +518,12 @@ public class PolybiusSquare{
|
||||
* @throws InvalidCharacterException if any character is invalid
|
||||
*/
|
||||
public PolybiusSquare(boolean preserveWhitespace, boolean preserveSymbols, char replaced, char replacer) throws InvalidCharacterException{
|
||||
reset();
|
||||
setReplaced(replaced);
|
||||
setReplacer(replacer);
|
||||
grid = new char[5][5];
|
||||
inputString = "";
|
||||
outputString = "";
|
||||
keyword = "";
|
||||
this.replaced = validateReplaced(replaced);
|
||||
this.replacer = validateReplacer(replacer);
|
||||
this.preserveWhitespace = preserveWhitespace;
|
||||
this.preserveSymbols = preserveSymbols;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/RailFence.java
|
||||
//Mattrixwv
|
||||
// Created: 03-21-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.polysubstitution;
|
||||
|
||||
|
||||
@@ -35,7 +15,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||
* The Rail Fence cipher is a form of transposition cipher that writes the message in a zigzag pattern
|
||||
* across multiple "rails" and then reads it off row by row to encode or decode the message.
|
||||
*/
|
||||
public class RailFence{
|
||||
public final class RailFence{
|
||||
private static final Logger logger = LoggerFactory.getLogger(RailFence.class);
|
||||
//?Fields
|
||||
/** The message that needs to be encoded/decoded */
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
//CipherStreamJava/src/main/java/com/mattrixwv/cipherstream/polysubstitution/Trifid.java
|
||||
//Mattrixwv
|
||||
// Created: 03-03-22
|
||||
//Modified: 08-11-24
|
||||
/*
|
||||
Copyright (C) 2024 Mattrixwv
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.mattrixwv.cipherstream.polysubstitution;
|
||||
|
||||
|
||||
@@ -37,7 +17,7 @@ import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||
* The {@code Trifid} class implements the Trifid cipher, a polyalphabetic substitution cipher
|
||||
* that uses a 3x3x3 grid to encode and decode messages.
|
||||
*/
|
||||
public class Trifid{
|
||||
public final class Trifid{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Trifid.class);
|
||||
|
||||
/** A class representing the location of a character in the grid */
|
||||
|
||||
@@ -121,7 +121,7 @@ public class PolybiusSquareTest{
|
||||
|
||||
assertEquals('A', cipher.replaced);
|
||||
verify(logger, times(1)).debug("Setting replaced");
|
||||
verify(logger, times(1)).debug("Original character {}", 'a');
|
||||
verify(logger, times(1)).debug("Validating replaced character {}", 'a');
|
||||
verify(logger, times(1)).debug("Checking replacer");
|
||||
verify(logger, times(1)).debug("Cleaned character {}", 'A');
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public class PolybiusSquareTest{
|
||||
|
||||
assertEquals('J', cipher.replaced);
|
||||
verify(logger, times(1)).debug("Setting replaced");
|
||||
verify(logger, times(1)).debug("Original character {}", '1');
|
||||
verify(logger, times(1)).debug("Validating replaced character {}", '1');
|
||||
verify(logger, never()).debug("Checking replacer");
|
||||
verify(logger, never()).debug(eq("Cleaned character {}"), anyChar());
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public class PolybiusSquareTest{
|
||||
|
||||
assertEquals('J', cipher.replaced);
|
||||
verify(logger, times(1)).debug("Setting replaced");
|
||||
verify(logger, times(1)).debug("Original character {}", cipher.replacer);
|
||||
verify(logger, times(1)).debug("Validating replaced character {}", cipher.replacer);
|
||||
verify(logger, times(1)).debug("Checking replacer");
|
||||
verify(logger, never()).debug(eq("Cleaned character {}"), anyChar());
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public class PolybiusSquareTest{
|
||||
|
||||
assertEquals('A', cipher.replacer);
|
||||
verify(logger, times(1)).debug("Setting replacer");
|
||||
verify(logger, times(1)).debug("Original character {}", 'a');
|
||||
verify(logger, times(1)).debug("Validating replacer character {}", 'a');
|
||||
verify(logger, times(1)).debug("Checking replaced");
|
||||
verify(logger, times(1)).debug("Cleaned character {}", 'A');
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public class PolybiusSquareTest{
|
||||
|
||||
assertEquals('I', cipher.replacer);
|
||||
verify(logger, times(1)).debug("Setting replacer");
|
||||
verify(logger, times(1)).debug("Original character {}", '1');
|
||||
verify(logger, times(1)).debug("Validating replacer character {}", '1');
|
||||
verify(logger, never()).debug("Checking replaced");
|
||||
verify(logger, never()).debug(eq("Cleaned character {}"), anyChar());
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class PolybiusSquareTest{
|
||||
|
||||
assertEquals('I', cipher.replacer);
|
||||
verify(logger, times(1)).debug("Setting replacer");
|
||||
verify(logger, times(1)).debug("Original character {}", cipher.replaced);
|
||||
verify(logger, times(1)).debug("Validating replacer character {}", cipher.replaced);
|
||||
verify(logger, times(1)).debug("Checking replaced");
|
||||
verify(logger, never()).debug(eq("Cleaned character {}"), anyChar());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user