Compare commits
5 Commits
v1.3.8
...
ec0bf31906
| Author | SHA1 | Date | |
|---|---|---|---|
|
ec0bf31906
|
|||
|
d12eb91245
|
|||
| f419e6020b | |||
| f9f61081bc | |||
| dc81847123 |
195
pom.xml
195
pom.xml
@@ -26,7 +26,7 @@
|
||||
|
||||
<groupId>com.mattrixwv</groupId>
|
||||
<artifactId>cipher-stream-java</artifactId>
|
||||
<version>1.3.8</version>
|
||||
<version>1.3.10-SNAPSHOT</version>
|
||||
|
||||
<name>CipherStreamJava</name>
|
||||
<description>A library to encrypt and decrypt simple ciphers</description>
|
||||
@@ -37,17 +37,16 @@
|
||||
<!--Compile-->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<java.version>21</java.version>
|
||||
<maven.compiler.source>25</maven.compiler.source>
|
||||
<maven.compiler.target>25</maven.compiler.target>
|
||||
<java.version>25</java.version>
|
||||
|
||||
<!--Sonarqube-->
|
||||
<sonar.java.source>21</sonar.java.source>
|
||||
<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>
|
||||
|
||||
<!--Deployment-->
|
||||
<gpg.keyname>3BA6515C8FF145249BEBBEABA52FDEC4259179D4</gpg.keyname>
|
||||
<argLine></argLine>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -55,13 +54,13 @@
|
||||
<dependency>
|
||||
<groupId>com.mattrixwv</groupId>
|
||||
<artifactId>myClasses</artifactId>
|
||||
<version>1.3.8</version>
|
||||
<version>1.3.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mattrixwv</groupId>
|
||||
<artifactId>matrix</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -73,29 +72,29 @@
|
||||
<!--Test-->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.12.2</version>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>6.0.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<version>5.12.2</version>
|
||||
<version>6.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>5.18.0</version>
|
||||
<version>5.21.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<version>5.18.0</version>
|
||||
<version>5.21.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -109,17 +108,93 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!--Ensure maven is the correct version-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-maven</id>
|
||||
<goals>
|
||||
<goal>enforce</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</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>
|
||||
<artifactId>dependency-check-maven</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>dependency-check</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!--Deployment-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!--Ensure maven is the correct version-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.6.2</version>
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireMavenVersion>
|
||||
@@ -127,61 +202,68 @@
|
||||
</requireMavenVersion>
|
||||
</rules>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.4.1</version>
|
||||
<version>3.5.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<version>3.14.1</version>
|
||||
<configuration>
|
||||
<release>${java.version}</release>
|
||||
<compilerArgs>
|
||||
<arg>-Xlint:all</arg>
|
||||
<arg>-Xlint:-serial</arg>
|
||||
</compilerArgs>
|
||||
<showWarnings>true</showWarnings>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.5.3</version>
|
||||
<version>3.5.4</version>
|
||||
<configuration>
|
||||
<argLine>@{argLine} -javaagent:${org.mockito:mockito-core:jar}</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.4.2</version>
|
||||
<version>3.5.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>3.1.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.1.4</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.7.1</version>
|
||||
<version>3.8.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.21.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.9.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>2.18.0</version>
|
||||
<version>2.20.1</version>
|
||||
<configuration>
|
||||
<rulesUri>file://${session.executionRootDirectory}/version-rules.xml</rulesUri>
|
||||
</configuration>
|
||||
@@ -189,18 +271,18 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>3.9.0</version>
|
||||
</plugin>
|
||||
<!--Sonarqube-->
|
||||
<plugin>
|
||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||
<artifactId>sonar-maven-plugin</artifactId>
|
||||
<version>5.1.0.4751</version>
|
||||
<version>5.5.0.6356</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.8.13</version>
|
||||
<version>0.8.14</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>jacoco-initialize</id>
|
||||
@@ -221,21 +303,15 @@
|
||||
<plugin>
|
||||
<groupId>org.owasp</groupId>
|
||||
<artifactId>dependency-check-maven</artifactId>
|
||||
<version>12.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>none</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<version>12.1.9</version>
|
||||
<configuration>
|
||||
<formats>
|
||||
<format>json</format>
|
||||
<format>html</format>
|
||||
</formats>
|
||||
<nvdApiServerId>nvd</nvdApiServerId>
|
||||
<failBuildOnCVSS>7</failBuildOnCVSS>
|
||||
<ossIndexServerId>ossindex</ossIndexServerId>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -243,29 +319,27 @@
|
||||
<plugin>
|
||||
<groupId>org.sonatype.central</groupId>
|
||||
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||
<version>0.7.0</version>
|
||||
<version>0.10.0</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<publishingServerId>ossrh</publishingServerId>
|
||||
<publishingServerId>central</publishingServerId>
|
||||
<autoPublish>true</autoPublish>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.7.0</version>
|
||||
<extensions>true</extensions>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>3.1.4</version>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<version>3.4.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
@@ -279,7 +353,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.11.2</version>
|
||||
<version>3.12.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
@@ -293,7 +367,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>3.2.7</version>
|
||||
<version>3.2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
@@ -301,23 +375,10 @@
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<keyname>${gpg.keyname}</keyname>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
|
||||
@@ -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