Fixed sonarqube findings
This commit is contained in:
9
pom.xml
9
pom.xml
@@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>mattrixwv</groupId>
|
<groupId>mattrixwv</groupId>
|
||||||
<artifactId>CipherStreamJava</artifactId>
|
<artifactId>cipher-stream-java</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>CipherStreamJava</name>
|
<name>CipherStreamJava</name>
|
||||||
@@ -13,8 +13,9 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
<maven.compiler.source>18</maven.compiler.source>
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
<maven.compiler.target>18</maven.compiler.target>
|
||||||
|
<sonar.java.source>18</sonar.java.source>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mattrixwv</groupId>
|
<groupId>com.mattrixwv</groupId>
|
||||||
<artifactId>matrix</artifactId>
|
<artifactId>matrix</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/combination/ADFGVX.java
|
//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/combination/ADFGVX.java
|
||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-26-22
|
// Created: 01-26-22
|
||||||
//Modified: 02-17-22
|
//Modified: 07-03-22
|
||||||
package com.mattrixwv.CipherStreamJava.combination;
|
package com.mattrixwv.cipherstream.combination;
|
||||||
|
|
||||||
|
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
import com.mattrixwv.CipherStreamJava.polySubstitution.Columnar;
|
import com.mattrixwv.cipherstream.polysubstitution.Columnar;
|
||||||
import com.mattrixwv.CipherStreamJava.polySubstitution.PolybiusSquare;
|
import com.mattrixwv.cipherstream.polysubstitution.PolybiusSquare;
|
||||||
|
|
||||||
|
|
||||||
public class ADFGVX{
|
public class ADFGVX{
|
||||||
@@ -221,7 +221,7 @@ public class ADFGVX{
|
|||||||
//Encode the input with polybius
|
//Encode the input with polybius
|
||||||
String polybiusOutput = largePolybiusSquare.encode(squareKeyword, inputString);
|
String polybiusOutput = largePolybiusSquare.encode(squareKeyword, inputString);
|
||||||
//Change polybius to use the correct symbols
|
//Change polybius to use the correct symbols
|
||||||
polybiusOutput = polybiusOutput.replaceAll("1", "A").replaceAll("2", "D").replaceAll("3", "F").replaceAll("4", "G").replaceAll("5", "V").replaceAll("6", "X");
|
polybiusOutput = polybiusOutput.replace("1", "A").replace("2", "D").replace("3", "F").replace("4", "G").replace("5", "V").replace("6", "X");
|
||||||
|
|
||||||
//Encode polybius's output with columnar
|
//Encode polybius's output with columnar
|
||||||
String columnarOutput = columnar.encode(keyword, polybiusOutput);
|
String columnarOutput = columnar.encode(keyword, polybiusOutput);
|
||||||
@@ -237,7 +237,7 @@ public class ADFGVX{
|
|||||||
String columnarOutput = columnar.decode(keyword, inputString);
|
String columnarOutput = columnar.decode(keyword, inputString);
|
||||||
|
|
||||||
//Change the symbols to the correct ones for polybius
|
//Change the symbols to the correct ones for polybius
|
||||||
columnarOutput = columnarOutput.replaceAll("A", "1").replaceAll("D", "2").replaceAll("F", "3").replaceAll("G", "4").replaceAll("V", "5").replaceAll("X", "6");
|
columnarOutput = columnarOutput.replace("A", "1").replace("D", "2").replace("F", "3").replace("G", "4").replace("V", "5").replace("X", "6");
|
||||||
//Decode with polybius
|
//Decode with polybius
|
||||||
String polybiusOutput = largePolybiusSquare.decode(squareKeyword, columnarOutput);
|
String polybiusOutput = largePolybiusSquare.decode(squareKeyword, columnarOutput);
|
||||||
outputString = polybiusOutput;
|
outputString = polybiusOutput;
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/combination/ADFGX.java
|
//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/combination/ADFGX.java
|
||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-25-22
|
// Created: 01-25-22
|
||||||
//Modified: 02-23-22
|
//Modified: 07-03-22
|
||||||
package com.mattrixwv.CipherStreamJava.combination;
|
package com.mattrixwv.cipherstream.combination;
|
||||||
|
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
import com.mattrixwv.CipherStreamJava.polySubstitution.Columnar;
|
import com.mattrixwv.cipherstream.polysubstitution.Columnar;
|
||||||
import com.mattrixwv.CipherStreamJava.polySubstitution.PolybiusSquare;
|
import com.mattrixwv.cipherstream.polysubstitution.PolybiusSquare;
|
||||||
|
|
||||||
|
|
||||||
public class ADFGX{
|
public class ADFGX{
|
||||||
@@ -106,7 +106,7 @@ public class ADFGX{
|
|||||||
String polybiusOutput = polybiusSquare.encode(squareKeyword, inputString);
|
String polybiusOutput = polybiusSquare.encode(squareKeyword, inputString);
|
||||||
squareKeyword = polybiusSquare.getKeyword();
|
squareKeyword = polybiusSquare.getKeyword();
|
||||||
//Change polybius to use the correct symbols
|
//Change polybius to use the correct symbols
|
||||||
polybiusOutput = polybiusOutput.replaceAll("1", "A").replaceAll("2", "D").replaceAll("3", "F").replaceAll("4", "G").replaceAll("5", "X");
|
polybiusOutput = polybiusOutput.replace("1", "A").replace("2", "D").replace("3", "F").replace("4", "G").replace("5", "X");
|
||||||
|
|
||||||
//Encode polybius's output with columnar
|
//Encode polybius's output with columnar
|
||||||
String columnarOutput = columnar.encode(keyword, polybiusOutput);
|
String columnarOutput = columnar.encode(keyword, polybiusOutput);
|
||||||
@@ -123,7 +123,7 @@ public class ADFGX{
|
|||||||
keyword = columnar.getKeyword();
|
keyword = columnar.getKeyword();
|
||||||
|
|
||||||
//Change the symbols to the correct ones for polybius
|
//Change the symbols to the correct ones for polybius
|
||||||
columnarOutput = columnarOutput.replaceAll("A", "1").replaceAll("D", "2").replaceAll("F", "3").replaceAll("G", "4").replaceAll("X", "5");
|
columnarOutput = columnarOutput.replace("A", "1").replace("D", "2").replace("F", "3").replace("G", "4").replace("X", "5");
|
||||||
//Decode with polybius
|
//Decode with polybius
|
||||||
String polybiusOutput = polybiusSquare.decode(squareKeyword, columnarOutput);
|
String polybiusOutput = polybiusSquare.decode(squareKeyword, columnarOutput);
|
||||||
squareKeyword = polybiusSquare.getKeyword();
|
squareKeyword = polybiusSquare.getKeyword();
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-09-22
|
// Created: 01-09-22
|
||||||
//Modified: 01-09-22
|
//Modified: 01-09-22
|
||||||
package com.mattrixwv.CipherStreamJava.exceptions;
|
package com.mattrixwv.cipherstream.exceptions;
|
||||||
|
|
||||||
|
|
||||||
public class InvalidBaseException extends Exception{
|
public class InvalidBaseException extends RuntimeException{
|
||||||
public InvalidBaseException(){
|
public InvalidBaseException(){
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-04-22
|
// Created: 01-04-22
|
||||||
//Modified: 01-04-22
|
//Modified: 01-04-22
|
||||||
package com.mattrixwv.CipherStreamJava.exceptions;
|
package com.mattrixwv.cipherstream.exceptions;
|
||||||
|
|
||||||
|
|
||||||
public class InvalidCharacterException extends Exception{
|
public class InvalidCharacterException extends RuntimeException{
|
||||||
public InvalidCharacterException(){
|
public InvalidCharacterException(){
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-09-22
|
// Created: 01-09-22
|
||||||
//Modified: 01-09-22
|
//Modified: 01-09-22
|
||||||
package com.mattrixwv.CipherStreamJava.exceptions;
|
package com.mattrixwv.cipherstream.exceptions;
|
||||||
|
|
||||||
|
|
||||||
public class InvalidInputException extends Exception{
|
public class InvalidInputException extends RuntimeException{
|
||||||
public InvalidInputException(){
|
public InvalidInputException(){
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-09-22
|
// Created: 01-09-22
|
||||||
//Modified: 01-09-22
|
//Modified: 01-09-22
|
||||||
package com.mattrixwv.CipherStreamJava.exceptions;
|
package com.mattrixwv.cipherstream.exceptions;
|
||||||
|
|
||||||
|
|
||||||
public class InvalidKeywordException extends Exception{
|
public class InvalidKeywordException extends RuntimeException{
|
||||||
public InvalidKeywordException(){
|
public InvalidKeywordException(){
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-26-22
|
// Created: 01-26-22
|
||||||
//Modified: 02-17-22
|
//Modified: 02-17-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
import mattrixwv.NumberAlgorithms;
|
import mattrixwv.NumberAlgorithms;
|
||||||
|
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 07-25-21
|
// Created: 07-25-21
|
||||||
//Modified: 02-22-22
|
//Modified: 02-22-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class Atbash{
|
public class Atbash{
|
||||||
@@ -14,32 +14,6 @@ public class Atbash{
|
|||||||
private boolean preserveCapitals; //Whether to respect capitals in the output string
|
private boolean preserveCapitals; //Whether to respect capitals in the output string
|
||||||
private boolean preserveWhitespace; //Whether to respect whitespace in the output string
|
private boolean preserveWhitespace; //Whether to respect whitespace in the output string
|
||||||
private boolean preserveSymbols; //Whether to respect symbols in the output string
|
private boolean preserveSymbols; //Whether to respect symbols in the output string
|
||||||
//Decodes inputString and stores in outputString
|
|
||||||
private String decode(){
|
|
||||||
StringBuilder output = new StringBuilder();
|
|
||||||
//Stop through every element in the inputString and shift it the correct amount
|
|
||||||
for(int cnt = 0;cnt < inputString.length();++cnt){
|
|
||||||
char currentChar = inputString.charAt(cnt);
|
|
||||||
//Decode if the letter is alphabetic
|
|
||||||
if(Character.isAlphabetic(currentChar)){
|
|
||||||
//Use either uppercase or lowercase for the base
|
|
||||||
//(letterbase + 25 - (currentChar - letterBase))
|
|
||||||
if(Character.isUpperCase(currentChar)){
|
|
||||||
output.append((char)(155 - currentChar));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
output.append((char)(219 - currentChar));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Keep any punctuation/whitespace the way it is
|
|
||||||
else{
|
|
||||||
output.append(currentChar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
outputString = output.toString();
|
|
||||||
return outputString;
|
|
||||||
}
|
|
||||||
//Encodes inputString and stores in outputString
|
//Encodes inputString and stores in outputString
|
||||||
private String encode(){
|
private String encode(){
|
||||||
StringBuilder output = new StringBuilder();
|
StringBuilder output = new StringBuilder();
|
||||||
@@ -119,10 +93,7 @@ public class Atbash{
|
|||||||
return encode();
|
return encode();
|
||||||
}
|
}
|
||||||
public String decode(String inputString) throws InvalidInputException{
|
public String decode(String inputString) throws InvalidInputException{
|
||||||
//Make sure everything is empty before you begin
|
return encode(inputString);
|
||||||
reset();
|
|
||||||
setInputString(inputString);
|
|
||||||
return decode();
|
|
||||||
}
|
}
|
||||||
public void reset(){
|
public void reset(){
|
||||||
inputString = outputString = "";
|
inputString = outputString = "";
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/Autokey.java
|
//CipherStreamJava/src/main/java/com/mattrixwv/CipherStreamJava/Autokey.java
|
||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 07-25-21
|
// Created: 07-25-21
|
||||||
//Modified: 02-22-22
|
//Modified: 07-03-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class Autokey extends Vigenere{
|
public class Autokey extends Vigenere{
|
||||||
@@ -40,7 +40,8 @@ public class Autokey extends Vigenere{
|
|||||||
setInputString(inputString);
|
setInputString(inputString);
|
||||||
}
|
}
|
||||||
//Decodes the inputString
|
//Decodes the inputString
|
||||||
protected String decode() throws InvalidKeywordException{
|
@Override
|
||||||
|
protected String decode(){
|
||||||
//Decode what the key will allow, add that to the key and continue
|
//Decode what the key will allow, add that to the key and continue
|
||||||
StringBuilder currentOutput = new StringBuilder();
|
StringBuilder currentOutput = new StringBuilder();
|
||||||
StringBuilder fullOutput = new StringBuilder();
|
StringBuilder fullOutput = new StringBuilder();
|
||||||
@@ -93,12 +94,14 @@ public class Autokey extends Vigenere{
|
|||||||
super(preserveCapitals, preserveWhitespace, preserveSymbols);
|
super(preserveCapitals, preserveWhitespace, preserveSymbols);
|
||||||
}
|
}
|
||||||
//Encodes inputString using the Autokey cipher
|
//Encodes inputString using the Autokey cipher
|
||||||
|
@Override
|
||||||
public String encode(String keyword, String inputString) throws InvalidKeywordException, InvalidInputException{
|
public String encode(String keyword, String inputString) throws InvalidKeywordException, InvalidInputException{
|
||||||
reset();
|
reset();
|
||||||
encodeSet(keyword, inputString);
|
encodeSet(keyword, inputString);
|
||||||
return encode();
|
return encode();
|
||||||
}
|
}
|
||||||
//Decodes inputString using the Autokey cipher
|
//Decodes inputString using the Autokey cipher
|
||||||
|
@Override
|
||||||
public String decode(String keyword, String inputString) throws InvalidKeywordException, InvalidInputException{
|
public String decode(String keyword, String inputString) throws InvalidKeywordException, InvalidInputException{
|
||||||
reset();
|
reset();
|
||||||
decodeSet(keyword, inputString);
|
decodeSet(keyword, inputString);
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-12-22
|
// Created: 01-12-22
|
||||||
//Modified: 01-16-22
|
//Modified: 01-16-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
public class Baconian{
|
public class Baconian{
|
||||||
private static final ArrayList<String> code = new ArrayList<String>(Arrays.asList(
|
private static final ArrayList<String> code = new ArrayList<>(Arrays.asList(
|
||||||
"aaaaa", "aaaab", "aaaba", "aaabb", "aabaa", "aabab", "aabba","aabbb", "abaaa", "abaaa", "abaab", "ababa", "ababb", //A-M
|
"aaaaa", "aaaab", "aaaba", "aaabb", "aabaa", "aabab", "aabba","aabbb", "abaaa", "abaaa", "abaab", "ababa", "ababb", //A-M
|
||||||
"abbaa", "abbab", "abbba", "abbbb", "baaaa", "baaab", "baaba", "baabb", "baabb", "babaa", "babab", "babba", "babbb" //N-Z
|
"abbaa", "abbab", "abbba", "abbbb", "baaaa", "baaab", "baaba", "baabb", "baabb", "babaa", "babab", "babba", "babbb" //N-Z
|
||||||
));
|
));
|
||||||
@@ -63,7 +63,7 @@ public class Baconian{
|
|||||||
this.inputString = inputString;
|
this.inputString = inputString;
|
||||||
|
|
||||||
if(this.inputString.isBlank()){
|
if(this.inputString.isBlank()){
|
||||||
throw new InvalidInputException("Input cannot be null");
|
throw new InvalidInputException("Input cannot be empty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Encodes the inputString and stores the result in outputString
|
//Encodes the inputString and stores the result in outputString
|
||||||
@@ -97,7 +97,7 @@ public class Baconian{
|
|||||||
int location = code.indexOf(baconianCharacter.toLowerCase());
|
int location = code.indexOf(baconianCharacter.toLowerCase());
|
||||||
|
|
||||||
//Convert the Baconian character to an ASCII character
|
//Convert the Baconian character to an ASCII character
|
||||||
char ch = '\0';
|
char ch;
|
||||||
if(Character.isUpperCase(baconianCharacter.charAt(0))){
|
if(Character.isUpperCase(baconianCharacter.charAt(0))){
|
||||||
ch = (char)(location + 'A');
|
ch = (char)(location + 'A');
|
||||||
}
|
}
|
||||||
@@ -2,14 +2,14 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-08-22
|
// Created: 01-08-22
|
||||||
//Modified: 01-09-22
|
//Modified: 01-09-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidBaseException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidBaseException;
|
||||||
|
|
||||||
|
|
||||||
public class BaseX{
|
public class BaseX{
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 02-23-22
|
// Created: 02-23-22
|
||||||
//Modified: 02-23-22
|
//Modified: 02-23-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class Beaufort{
|
public class Beaufort{
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 07-25-21
|
// Created: 07-25-21
|
||||||
//Modified: 02-17-22
|
//Modified: 02-17-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class Caesar{
|
public class Caesar{
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 02-23-22
|
// Created: 02-23-22
|
||||||
//Modified: 02-23-22
|
//Modified: 02-23-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class OneTimePad extends Vigenere{
|
public class OneTimePad extends Vigenere{
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 02-28-22
|
// Created: 02-28-22
|
||||||
//Modified: 02-28-22
|
//Modified: 02-28-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class Porta{
|
public class Porta{
|
||||||
@@ -78,7 +78,7 @@ public class Porta{
|
|||||||
private char getReplacer(int keywordCnt, char letter){
|
private char getReplacer(int keywordCnt, char letter){
|
||||||
char keyLetter = keyword.charAt(keywordCnt % keyword.length());
|
char keyLetter = keyword.charAt(keywordCnt % keyword.length());
|
||||||
int tableauColumn = (Character.toUpperCase(letter) - 'A');
|
int tableauColumn = (Character.toUpperCase(letter) - 'A');
|
||||||
char replacer = '\0';
|
char replacer;
|
||||||
|
|
||||||
switch(keyLetter){
|
switch(keyLetter){
|
||||||
case 'A':
|
case 'A':
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 02-22-22
|
// Created: 02-22-22
|
||||||
//Modified: 02-22-22
|
//Modified: 02-22-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class Substitution{
|
public class Substitution{
|
||||||
@@ -2,13 +2,14 @@
|
|||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 07-25-21
|
// Created: 07-25-21
|
||||||
//Modified: 02-22-22
|
//Modified: 02-22-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class Vigenere{
|
public class Vigenere{
|
||||||
@@ -110,7 +111,7 @@ public class Vigenere{
|
|||||||
return outputString;
|
return outputString;
|
||||||
}
|
}
|
||||||
//Decodes inputString and stores the result in outputString
|
//Decodes inputString and stores the result in outputString
|
||||||
protected String decode() throws InvalidKeywordException{
|
protected String decode(){
|
||||||
StringBuilder output = new StringBuilder();
|
StringBuilder output = new StringBuilder();
|
||||||
|
|
||||||
//Step through every character in the inputString and advance it the correct amount, according to offset
|
//Step through every character in the inputString and advance it the correct amount, according to offset
|
||||||
@@ -145,14 +146,14 @@ public class Vigenere{
|
|||||||
|
|
||||||
//Constructor
|
//Constructor
|
||||||
public Vigenere(){
|
public Vigenere(){
|
||||||
offset = new ArrayList<Integer>();
|
offset = new ArrayList<>();
|
||||||
reset();
|
reset();
|
||||||
preserveCapitals = false;
|
preserveCapitals = false;
|
||||||
preserveWhitespace = false;
|
preserveWhitespace = false;
|
||||||
preserveSymbols = false;
|
preserveSymbols = false;
|
||||||
}
|
}
|
||||||
public Vigenere(boolean preserveCapitals, boolean preserveWhitespace, boolean preserveSymbols){
|
public Vigenere(boolean preserveCapitals, boolean preserveWhitespace, boolean preserveSymbols){
|
||||||
offset = new ArrayList<Integer>();
|
offset = new ArrayList<>();
|
||||||
reset();
|
reset();
|
||||||
this.preserveCapitals = preserveCapitals;
|
this.preserveCapitals = preserveCapitals;
|
||||||
this.preserveWhitespace = preserveWhitespace;
|
this.preserveWhitespace = preserveWhitespace;
|
||||||
@@ -171,7 +172,7 @@ public class Vigenere{
|
|||||||
return keyword;
|
return keyword;
|
||||||
}
|
}
|
||||||
//Returns the current offsets (Used mostly in bug fixing)
|
//Returns the current offsets (Used mostly in bug fixing)
|
||||||
public ArrayList<Integer> getOffsets(){
|
public List<Integer> getOffsets(){
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
//Encodes input using key and returns the result
|
//Encodes input using key and returns the result
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 03-03-22
|
// Created: 03-03-22
|
||||||
//Modified: 03-03-22
|
//Modified: 03-03-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
public class Bifid{
|
public class Bifid{
|
||||||
private String inputString; //The message that needs to be encoded/decoded
|
private String inputString; //The message that needs to be encoded/decoded
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-16-22
|
// Created: 01-16-22
|
||||||
//Modified: 03-03-22
|
//Modified: 03-03-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class Columnar{
|
public class Columnar{
|
||||||
@@ -33,8 +33,8 @@ public class Columnar{
|
|||||||
//Create the grid from the keyword
|
//Create the grid from the keyword
|
||||||
private void createGridEncode(){
|
private void createGridEncode(){
|
||||||
//Add the keyword to the first row in the array
|
//Add the keyword to the first row in the array
|
||||||
grid = new ArrayList<ArrayList<Character>>();
|
grid = new ArrayList<>();
|
||||||
grid.add(new ArrayList<Character>(Arrays.asList(keyword.chars().mapToObj(c -> (char)c).toArray(Character[]::new))));
|
grid.add(new ArrayList<>(Arrays.asList(keyword.chars().mapToObj(c -> (char)c).toArray(Character[]::new))));
|
||||||
|
|
||||||
//Create the input that will be used for encoding
|
//Create the input that will be used for encoding
|
||||||
String gridInputString = getCleanInputString();
|
String gridInputString = getCleanInputString();
|
||||||
@@ -42,7 +42,7 @@ public class Columnar{
|
|||||||
//Create arrays from the inputString of keyword.size length and add them each as new rows to the grid
|
//Create arrays from the inputString of keyword.size length and add them each as new rows to the grid
|
||||||
//?gridRow could be changed to grid.size(), but would it be worth the extra confusion? Probably not unless I really want to min/max
|
//?gridRow could be changed to grid.size(), but would it be worth the extra confusion? Probably not unless I really want to min/max
|
||||||
for(int gridRow = 1;(keyword.length() * gridRow) <= gridInputString.length();++gridRow){
|
for(int gridRow = 1;(keyword.length() * gridRow) <= gridInputString.length();++gridRow){
|
||||||
grid.add(new ArrayList<Character>(Arrays.asList(
|
grid.add(new ArrayList<>(Arrays.asList(
|
||||||
gridInputString.substring(keyword.length() * (gridRow - 1), (keyword.length() * gridRow))
|
gridInputString.substring(keyword.length() * (gridRow - 1), (keyword.length() * gridRow))
|
||||||
.chars().mapToObj(c->(char)c).toArray(Character[]::new)
|
.chars().mapToObj(c->(char)c).toArray(Character[]::new)
|
||||||
)));
|
)));
|
||||||
@@ -50,12 +50,12 @@ public class Columnar{
|
|||||||
}
|
}
|
||||||
private void createGridDecode(){
|
private void createGridDecode(){
|
||||||
//Add the keyword to the first row in the array
|
//Add the keyword to the first row in the array
|
||||||
grid = new ArrayList<ArrayList<Character>>();
|
grid = new ArrayList<>();
|
||||||
StringBuilder orderedKeyword = new StringBuilder();
|
StringBuilder orderedKeyword = new StringBuilder();
|
||||||
for(int cnt : getKeywordAlphaLocations()){
|
for(int cnt : getKeywordAlphaLocations()){
|
||||||
orderedKeyword.append(keyword.charAt(cnt));
|
orderedKeyword.append(keyword.charAt(cnt));
|
||||||
}
|
}
|
||||||
grid.add(new ArrayList<Character>(Arrays.asList(orderedKeyword.chars().mapToObj(c -> (char)c).toArray(Character[]::new))));
|
grid.add(new ArrayList<>(Arrays.asList(orderedKeyword.chars().mapToObj(c -> (char)c).toArray(Character[]::new))));
|
||||||
|
|
||||||
//Create the input that will be used for encoding
|
//Create the input that will be used for encoding
|
||||||
String gridInputString = getCleanInputString();
|
String gridInputString = getCleanInputString();
|
||||||
@@ -63,7 +63,7 @@ public class Columnar{
|
|||||||
//Make sure the grid has the appropritate number of rows
|
//Make sure the grid has the appropritate number of rows
|
||||||
int numRows = inputString.length() / keyword.length();
|
int numRows = inputString.length() / keyword.length();
|
||||||
while(grid.size() <= numRows){
|
while(grid.size() <= numRows){
|
||||||
grid.add(new ArrayList<Character>());
|
grid.add(new ArrayList<>());
|
||||||
}
|
}
|
||||||
//Add each character to the grid
|
//Add each character to the grid
|
||||||
int rowCnt = 1;
|
int rowCnt = 1;
|
||||||
@@ -142,7 +142,7 @@ public class Columnar{
|
|||||||
if(numCharsOver > 0){
|
if(numCharsOver > 0){
|
||||||
//Get the first n of the characters in the keyword and their encoded column locations
|
//Get the first n of the characters in the keyword and their encoded column locations
|
||||||
ArrayList<Integer> originalLocations = getKeywordOriginalLocations();
|
ArrayList<Integer> originalLocations = getKeywordOriginalLocations();
|
||||||
ArrayList<Integer> longColumns = new ArrayList<Integer>();
|
ArrayList<Integer> longColumns = new ArrayList<>();
|
||||||
for(int cnt = 0;cnt < numCharsOver;++cnt){
|
for(int cnt = 0;cnt < numCharsOver;++cnt){
|
||||||
longColumns.add(originalLocations.get(cnt));
|
longColumns.add(originalLocations.get(cnt));
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ public class Columnar{
|
|||||||
//Creates the output string from the grid
|
//Creates the output string from the grid
|
||||||
private void createOutputStringFromColumns(){
|
private void createOutputStringFromColumns(){
|
||||||
//Get the current rows of any characters that you added
|
//Get the current rows of any characters that you added
|
||||||
ArrayList<Integer> colsAddedTo = new ArrayList<Integer>();
|
ArrayList<Integer> colsAddedTo = new ArrayList<>();
|
||||||
if(removePadding){
|
if(removePadding){
|
||||||
ArrayList<Integer> cols = getKeywordOriginalLocations();
|
ArrayList<Integer> cols = getKeywordOriginalLocations();
|
||||||
Collections.reverse(cols);
|
Collections.reverse(cols);
|
||||||
@@ -251,7 +251,7 @@ public class Columnar{
|
|||||||
charsAdded = 0;
|
charsAdded = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Integer> colsAddedTo = new ArrayList<Integer>();
|
ArrayList<Integer> colsAddedTo = new ArrayList<>();
|
||||||
if(removePadding){
|
if(removePadding){
|
||||||
ArrayList<Integer> cols = getKeywordOriginalLocations();
|
ArrayList<Integer> cols = getKeywordOriginalLocations();
|
||||||
Collections.reverse(cols);
|
Collections.reverse(cols);
|
||||||
@@ -320,7 +320,7 @@ public class Columnar{
|
|||||||
}
|
}
|
||||||
//Returns a list of integers that represents the location of the characters of the keyword in alphabetic order
|
//Returns a list of integers that represents the location of the characters of the keyword in alphabetic order
|
||||||
private ArrayList<Integer> getKeywordAlphaLocations(){
|
private ArrayList<Integer> getKeywordAlphaLocations(){
|
||||||
ArrayList<Integer> orderedLocations = new ArrayList<Integer>();
|
ArrayList<Integer> orderedLocations = new ArrayList<>();
|
||||||
//go through every letter and check it against the keyword
|
//go through every letter and check it against the keyword
|
||||||
for(char ch = 'A';ch <= 'Z';++ch){
|
for(char ch = 'A';ch <= 'Z';++ch){
|
||||||
for(int cnt = 0;cnt < keyword.length();++cnt){
|
for(int cnt = 0;cnt < keyword.length();++cnt){
|
||||||
@@ -338,7 +338,7 @@ public class Columnar{
|
|||||||
//Figure out the order the columns are in
|
//Figure out the order the columns are in
|
||||||
ArrayList<Integer> orderedLocations = getKeywordAlphaLocations();
|
ArrayList<Integer> orderedLocations = getKeywordAlphaLocations();
|
||||||
//Figure out what order the columns need rearanged to
|
//Figure out what order the columns need rearanged to
|
||||||
ArrayList<Integer> originalOrder = new ArrayList<Integer>();
|
ArrayList<Integer> originalOrder = new ArrayList<>();
|
||||||
for(int orgCnt = 0;orgCnt < orderedLocations.size();++orgCnt){
|
for(int orgCnt = 0;orgCnt < orderedLocations.size();++orgCnt){
|
||||||
for(int orderedCnt = 0;orderedCnt < orderedLocations.size();++orderedCnt){
|
for(int orderedCnt = 0;orderedCnt < orderedLocations.size();++orderedCnt){
|
||||||
if(orderedLocations.get(orderedCnt) == orgCnt){
|
if(orderedLocations.get(orderedCnt) == orgCnt){
|
||||||
@@ -353,9 +353,9 @@ public class Columnar{
|
|||||||
private void rearangeGrid(ArrayList<Integer> listOrder){
|
private void rearangeGrid(ArrayList<Integer> listOrder){
|
||||||
//Create a new grid and make sure it is the same size as the original grid
|
//Create a new grid and make sure it is the same size as the original grid
|
||||||
int numCol = grid.get(0).size();
|
int numCol = grid.get(0).size();
|
||||||
ArrayList<ArrayList<Character>> newGrid = new ArrayList<ArrayList<Character>>(grid.size());
|
ArrayList<ArrayList<Character>> newGrid = new ArrayList<>(grid.size());
|
||||||
for(int cnt = 0;cnt < grid.size();++cnt){
|
for(int cnt = 0;cnt < grid.size();++cnt){
|
||||||
newGrid.add(new ArrayList<Character>(numCol));
|
newGrid.add(new ArrayList<>(numCol));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Step through the list order, pull out the columns, and add them to the new grid
|
//Step through the list order, pull out the columns, and add them to the new grid
|
||||||
@@ -443,7 +443,7 @@ public class Columnar{
|
|||||||
inputString = "";
|
inputString = "";
|
||||||
outputString = "";
|
outputString = "";
|
||||||
keyword = "";
|
keyword = "";
|
||||||
grid = new ArrayList<ArrayList<Character>>();
|
grid = new ArrayList<>();
|
||||||
charsAdded = 0;
|
charsAdded = 0;
|
||||||
}
|
}
|
||||||
//Gets
|
//Gets
|
||||||
@@ -2,14 +2,14 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-31-22
|
// Created: 01-31-22
|
||||||
//Modified: 02-17-22
|
//Modified: 02-17-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.matrix.ModMatrix;
|
import com.mattrixwv.matrix.ModMatrix;
|
||||||
import com.mattrixwv.matrix.exceptions.InvalidGeometryException;
|
import com.mattrixwv.matrix.exceptions.InvalidGeometryException;
|
||||||
import com.mattrixwv.matrix.exceptions.InvalidScalarException;
|
import com.mattrixwv.matrix.exceptions.InvalidScalarException;
|
||||||
@@ -46,7 +46,7 @@ public class Hill{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Set the key
|
//Set the key
|
||||||
this.key = key.clone();
|
this.key = new ModMatrix(key);
|
||||||
}
|
}
|
||||||
private void setInputString(String inputString) throws InvalidInputException{
|
private void setInputString(String inputString) throws InvalidInputException{
|
||||||
//Remove anything that needs removed
|
//Remove anything that needs removed
|
||||||
@@ -135,7 +135,7 @@ public class Hill{
|
|||||||
String cleanInput = getCleanInputString();
|
String cleanInput = getCleanInputString();
|
||||||
|
|
||||||
//Break the inputString up into lengths of numCols
|
//Break the inputString up into lengths of numCols
|
||||||
ArrayList<ModMatrix> vectors = new ArrayList<ModMatrix>();
|
ArrayList<ModMatrix> vectors = new ArrayList<>();
|
||||||
for(int cnt = 0;cnt < cleanInput.length();cnt += numCols){
|
for(int cnt = 0;cnt < cleanInput.length();cnt += numCols){
|
||||||
String subString = cleanInput.substring(cnt, cnt + numCols);
|
String subString = cleanInput.substring(cnt, cnt + numCols);
|
||||||
int[] grid = new int[numCols];
|
int[] grid = new int[numCols];
|
||||||
@@ -174,7 +174,7 @@ public class Hill{
|
|||||||
ArrayList<ModMatrix> inputVectors = getInputVectors();
|
ArrayList<ModMatrix> inputVectors = getInputVectors();
|
||||||
|
|
||||||
//Multiply the key by each vector and add the result to a new vector
|
//Multiply the key by each vector and add the result to a new vector
|
||||||
ArrayList<ModMatrix> outputVectors = new ArrayList<ModMatrix>();
|
ArrayList<ModMatrix> outputVectors = new ArrayList<>();
|
||||||
for(ModMatrix inputVector : inputVectors){
|
for(ModMatrix inputVector : inputVectors){
|
||||||
ModMatrix outputVector = key.multiply(inputVector);
|
ModMatrix outputVector = key.multiply(inputVector);
|
||||||
outputVectors.add(outputVector);
|
outputVectors.add(outputVector);
|
||||||
@@ -195,7 +195,7 @@ public class Hill{
|
|||||||
|
|
||||||
//Multiply the inverse of the key by each vector and add the result to a new vector
|
//Multiply the inverse of the key by each vector and add the result to a new vector
|
||||||
ModMatrix inverseKey = key.inverse();
|
ModMatrix inverseKey = key.inverse();
|
||||||
ArrayList<ModMatrix> outputVectors = new ArrayList<ModMatrix>();
|
ArrayList<ModMatrix> outputVectors = new ArrayList<>();
|
||||||
for(ModMatrix inputVector : inputVectors){
|
for(ModMatrix inputVector : inputVectors){
|
||||||
ModMatrix outputVector = inverseKey.multiply(inputVector);
|
ModMatrix outputVector = inverseKey.multiply(inputVector);
|
||||||
outputVectors.add(outputVector);
|
outputVectors.add(outputVector);
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 07-28-21
|
// Created: 07-28-21
|
||||||
//Modified: 01-16-22
|
//Modified: 01-16-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
public class Morse{
|
public class Morse{
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 07-30-21
|
// Created: 07-30-21
|
||||||
//Modified: 02-17-22
|
//Modified: 02-17-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class Playfair{
|
public class Playfair{
|
||||||
@@ -74,6 +74,23 @@ public class Playfair{
|
|||||||
|
|
||||||
//If this is encoding parse it and clean up an problems
|
//If this is encoding parse it and clean up an problems
|
||||||
if(encoding){
|
if(encoding){
|
||||||
|
setEncodingInputString(inputString);
|
||||||
|
}
|
||||||
|
//If this is decoding just add it without parsing it
|
||||||
|
else{
|
||||||
|
//Throw an exception if replaced is included
|
||||||
|
if(inputString.contains(Character.toString(replaced))){
|
||||||
|
throw new InvalidCharacterException("An encoded message cannot contain a letter that needs replaced");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.inputString = inputString;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.inputString.isBlank() || getPreparedInputString().isBlank()){
|
||||||
|
throw new InvalidInputException("Input must have at least 1 letter");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void setEncodingInputString(String inputString){
|
||||||
//Replace characters that need replaced
|
//Replace characters that need replaced
|
||||||
inputString = inputString.replaceAll(Character.toString(replaced), Character.toString(replacer));
|
inputString = inputString.replaceAll(Character.toString(replaced), Character.toString(replacer));
|
||||||
|
|
||||||
@@ -137,20 +154,6 @@ public class Playfair{
|
|||||||
|
|
||||||
this.inputString = cleanInput.toString();
|
this.inputString = cleanInput.toString();
|
||||||
}
|
}
|
||||||
//If this is decoding just add it without parsing it
|
|
||||||
else{
|
|
||||||
//Throw an exception if replaced is included
|
|
||||||
if(inputString.contains(Character.toString(replaced))){
|
|
||||||
throw new InvalidCharacterException("An encoded message cannot contain a letter that needs replaced");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.inputString = inputString;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.inputString.isBlank() || getPreparedInputString().isBlank()){
|
|
||||||
throw new InvalidInputException("Input must have at least 1 letter");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Returns the input string ready for encoding
|
//Returns the input string ready for encoding
|
||||||
private String getPreparedInputString(){
|
private String getPreparedInputString(){
|
||||||
String cleanString = inputString.toUpperCase();
|
String cleanString = inputString.toUpperCase();
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-04-22
|
// Created: 01-04-22
|
||||||
//Modified: 02-17-22
|
//Modified: 02-17-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class PolybiusSquare{
|
public class PolybiusSquare{
|
||||||
@@ -135,8 +135,7 @@ public class PolybiusSquare{
|
|||||||
return cleanString;
|
return cleanString;
|
||||||
}
|
}
|
||||||
protected String getPreparedInputStringDecoding(){
|
protected String getPreparedInputStringDecoding(){
|
||||||
String cleanString = inputString.replaceAll("[^0-9]", "");
|
return inputString.replaceAll("[^0-9]", "");
|
||||||
return cleanString;
|
|
||||||
}
|
}
|
||||||
//Strips invalid characters from the keyword and creates the grid
|
//Strips invalid characters from the keyword and creates the grid
|
||||||
protected void setKeyword(String keyword){
|
protected void setKeyword(String keyword){
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 03-21-22
|
// Created: 03-21-22
|
||||||
//Modified: 03-22-22
|
//Modified: 03-22-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidBaseException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidBaseException;
|
||||||
|
|
||||||
|
|
||||||
public class RailFence{
|
public class RailFence{
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 03-03-22
|
// Created: 03-03-22
|
||||||
//Modified: 03-03-22
|
//Modified: 03-03-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidBaseException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
import com.mattrixwv.cipherstream.exceptions.InvalidBaseException;
|
||||||
|
|
||||||
|
|
||||||
public class Trifid{
|
public class Trifid{
|
||||||
@@ -194,7 +194,7 @@ public class Trifid{
|
|||||||
//Encodes inputString using a polybius square and stores the result in outputString
|
//Encodes inputString using a polybius square and stores the result in outputString
|
||||||
private void encode() throws InvalidCharacterException{
|
private void encode() throws InvalidCharacterException{
|
||||||
//Step through every element in the sanitized inputString encoding the letters
|
//Step through every element in the sanitized inputString encoding the letters
|
||||||
ArrayList<CharLocation> locations = new ArrayList<CharLocation>();
|
ArrayList<CharLocation> locations = new ArrayList<>();
|
||||||
for(char ch : getCleanInputString().toCharArray()){
|
for(char ch : getCleanInputString().toCharArray()){
|
||||||
//Get the location of the char in the grid
|
//Get the location of the char in the grid
|
||||||
CharLocation location = findChar(ch);
|
CharLocation location = findChar(ch);
|
||||||
@@ -206,9 +206,9 @@ public class Trifid{
|
|||||||
if(numGroups == 0){
|
if(numGroups == 0){
|
||||||
numGroups = 1;
|
numGroups = 1;
|
||||||
}
|
}
|
||||||
ArrayList<ArrayList<CharLocation>> groups = new ArrayList<ArrayList<CharLocation>>(numGroups);
|
ArrayList<ArrayList<CharLocation>> groups = new ArrayList<>(numGroups);
|
||||||
for(int cnt = 0;cnt < numGroups;++cnt){
|
for(int cnt = 0;cnt < numGroups;++cnt){
|
||||||
groups.add(new ArrayList<CharLocation>());
|
groups.add(new ArrayList<>());
|
||||||
}
|
}
|
||||||
int groupCnt = -1;
|
int groupCnt = -1;
|
||||||
for(int locCnt = 0;locCnt < locations.size();++locCnt){
|
for(int locCnt = 0;locCnt < locations.size();++locCnt){
|
||||||
@@ -220,12 +220,12 @@ public class Trifid{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Split the coordinates into rows
|
//Split the coordinates into rows
|
||||||
ArrayList<Integer> coordinates = new ArrayList<Integer>(locations.size() * 3);
|
ArrayList<Integer> coordinates = new ArrayList<>(locations.size() * 3);
|
||||||
for(ArrayList<CharLocation> group : groups){
|
for(ArrayList<CharLocation> group : groups){
|
||||||
//Split the coordinates up into 3 rows
|
//Split the coordinates up into 3 rows
|
||||||
ArrayList<Integer> layers = new ArrayList<Integer>(group.size());
|
ArrayList<Integer> layers = new ArrayList<>(group.size());
|
||||||
ArrayList<Integer> rows = new ArrayList<Integer>(group.size());
|
ArrayList<Integer> rows = new ArrayList<>(group.size());
|
||||||
ArrayList<Integer> cols = new ArrayList<Integer>(group.size());
|
ArrayList<Integer> cols = new ArrayList<>(group.size());
|
||||||
for(CharLocation loc : group){
|
for(CharLocation loc : group){
|
||||||
layers.add(loc.getZ());
|
layers.add(loc.getZ());
|
||||||
rows.add(loc.getX());
|
rows.add(loc.getX());
|
||||||
@@ -236,7 +236,7 @@ public class Trifid{
|
|||||||
coordinates.addAll(cols);
|
coordinates.addAll(cols);
|
||||||
}
|
}
|
||||||
//Create new locations from the rows of coordinates
|
//Create new locations from the rows of coordinates
|
||||||
ArrayList<CharLocation> newLocations = new ArrayList<CharLocation>(locations.size());
|
ArrayList<CharLocation> newLocations = new ArrayList<>(locations.size());
|
||||||
for(int cnt = 0;cnt < coordinates.size();){
|
for(int cnt = 0;cnt < coordinates.size();){
|
||||||
int z = coordinates.get(cnt++);
|
int z = coordinates.get(cnt++);
|
||||||
int x = coordinates.get(cnt++);
|
int x = coordinates.get(cnt++);
|
||||||
@@ -256,7 +256,7 @@ public class Trifid{
|
|||||||
//Decodes inputString using a polybius square and stores the result in outputString
|
//Decodes inputString using a polybius square and stores the result in outputString
|
||||||
private void decode() throws InvalidCharacterException{
|
private void decode() throws InvalidCharacterException{
|
||||||
//Step through every element in the sanitized inputString encoding the letters
|
//Step through every element in the sanitized inputString encoding the letters
|
||||||
ArrayList<CharLocation> locations = new ArrayList<CharLocation>();
|
ArrayList<CharLocation> locations = new ArrayList<>();
|
||||||
for(char ch : getCleanInputString().toCharArray()){
|
for(char ch : getCleanInputString().toCharArray()){
|
||||||
//Get the location of the char in the grid
|
//Get the location of the char in the grid
|
||||||
CharLocation location = findChar(ch);
|
CharLocation location = findChar(ch);
|
||||||
@@ -268,9 +268,9 @@ public class Trifid{
|
|||||||
if(numGroups == 0){
|
if(numGroups == 0){
|
||||||
numGroups = 1;
|
numGroups = 1;
|
||||||
}
|
}
|
||||||
ArrayList<ArrayList<CharLocation>> groups = new ArrayList<ArrayList<CharLocation>>(numGroups);
|
ArrayList<ArrayList<CharLocation>> groups = new ArrayList<>(numGroups);
|
||||||
for(int cnt = 0;cnt < numGroups;++cnt){
|
for(int cnt = 0;cnt < numGroups;++cnt){
|
||||||
groups.add(new ArrayList<CharLocation>());
|
groups.add(new ArrayList<>());
|
||||||
}
|
}
|
||||||
int groupCnt = -1;
|
int groupCnt = -1;
|
||||||
for(int locCnt = 0;locCnt < locations.size();++locCnt){
|
for(int locCnt = 0;locCnt < locations.size();++locCnt){
|
||||||
@@ -282,10 +282,10 @@ public class Trifid{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Split the coordinates into rows by group and create the original grid locations
|
//Split the coordinates into rows by group and create the original grid locations
|
||||||
ArrayList<CharLocation> originalLocations = new ArrayList<CharLocation>(locations.size());
|
ArrayList<CharLocation> originalLocations = new ArrayList<>(locations.size());
|
||||||
for(ArrayList<CharLocation> group : groups){
|
for(ArrayList<CharLocation> group : groups){
|
||||||
//Read all of the coordinates from the group out into a row
|
//Read all of the coordinates from the group out into a row
|
||||||
ArrayList<Integer> coordinates = new ArrayList<Integer>(group.size() * 3);
|
ArrayList<Integer> coordinates = new ArrayList<>(group.size() * 3);
|
||||||
for(CharLocation loc : group){
|
for(CharLocation loc : group){
|
||||||
coordinates.add(loc.getZ());
|
coordinates.add(loc.getZ());
|
||||||
coordinates.add(loc.getX());
|
coordinates.add(loc.getX());
|
||||||
@@ -293,7 +293,7 @@ public class Trifid{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Read out the coordinates into new locations
|
//Read out the coordinates into new locations
|
||||||
ArrayList<CharLocation> originalGroup = new ArrayList<CharLocation>(group.size());
|
ArrayList<CharLocation> originalGroup = new ArrayList<>(group.size());
|
||||||
for(int cnt = 0;cnt < group.size();++cnt){
|
for(int cnt = 0;cnt < group.size();++cnt){
|
||||||
originalGroup.add(new CharLocation(0, 0, 0));
|
originalGroup.add(new CharLocation(0, 0, 0));
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ public class Trifid{
|
|||||||
return outputString;
|
return outputString;
|
||||||
}
|
}
|
||||||
//Decodes inputString using keyword and groupSize and returns the result
|
//Decodes inputString using keyword and groupSize and returns the result
|
||||||
public String decode(String keyword, String inputString) throws InvalidCharacterException, InvalidBaseException, InvalidKeywordException, InvalidInputException, InvalidCharacterException{
|
public String decode(String keyword, String inputString) throws InvalidBaseException, InvalidKeywordException, InvalidInputException, InvalidCharacterException{
|
||||||
return decode(keyword, inputString.length(), inputString);
|
return decode(keyword, inputString.length(), inputString);
|
||||||
}
|
}
|
||||||
public String decode(String keyword, int groupSize, String inputString) throws InvalidBaseException, InvalidKeywordException, InvalidInputException, InvalidCharacterException{
|
public String decode(String keyword, int groupSize, String inputString) throws InvalidBaseException, InvalidKeywordException, InvalidInputException, InvalidCharacterException{
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-26-22
|
// Created: 01-26-22
|
||||||
//Modified: 01-26-22
|
//Modified: 01-26-22
|
||||||
package com.mattrixwv.CipherStreamJava.combination;
|
package com.mattrixwv.cipherstream.combination;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestADFGVX{
|
public class TestADFGVX{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-25-22
|
// Created: 01-25-22
|
||||||
//Modified: 01-25-22
|
//Modified: 01-25-22
|
||||||
package com.mattrixwv.CipherStreamJava.combination;
|
package com.mattrixwv.cipherstream.combination;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestADFGX{
|
public class TestADFGX{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-26-22
|
// Created: 01-26-22
|
||||||
//Modified: 01-26-22
|
//Modified: 01-26-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestAffine{
|
public class TestAffine{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,15 +2,15 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 07-25-21
|
// Created: 07-25-21
|
||||||
//Modified: 02-22-22
|
//Modified: 02-22-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class TestAtbash{
|
public class TestAtbash{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 07-26-21
|
// Created: 07-26-21
|
||||||
//Modified: 02-22-22
|
//Modified: 02-22-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestAutokey{
|
public class TestAutokey{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-12-22
|
// Created: 01-12-22
|
||||||
//Modified: 01-12-22
|
//Modified: 01-12-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class TestBaconian{
|
public class TestBaconian{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-08-22
|
// Created: 01-08-22
|
||||||
//Modified: 01-09-22
|
//Modified: 01-09-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidBaseException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidBaseException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class TestBaseX{
|
public class TestBaseX{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 02-23-22
|
// Created: 02-23-22
|
||||||
//Modified: 02-23-22
|
//Modified: 02-23-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestBeaufort{
|
public class TestBeaufort{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,15 +2,15 @@
|
|||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 07-25-21
|
// Created: 07-25-21
|
||||||
//Modified: 01-04-22
|
//Modified: 01-04-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class TestCaesar{
|
public class TestCaesar{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 02-23-22
|
// Created: 02-23-22
|
||||||
//Modified: 02-23-22
|
//Modified: 02-23-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestOneTimePad{
|
public class TestOneTimePad{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 02-28-22
|
// Created: 02-28-22
|
||||||
//Modified: 02-28-22
|
//Modified: 02-28-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestPorta{
|
public class TestPorta{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 02-22-22
|
// Created: 02-22-22
|
||||||
//Modified: 02-22-22
|
//Modified: 02-22-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestSubstitution{
|
public class TestSubstitution{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 07-25-21
|
// Created: 07-25-21
|
||||||
//Modified: 02-22-22
|
//Modified: 02-22-22
|
||||||
package com.mattrixwv.CipherStreamJava.monoSubstitution;
|
package com.mattrixwv.cipherstream.monosubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestVigenere{
|
public class TestVigenere{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 03-03-22
|
// Created: 03-03-22
|
||||||
//Modified: 03-03-22
|
//Modified: 03-03-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestBifid{
|
public class TestBifid{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-16-22
|
// Created: 01-16-22
|
||||||
//Modified: 03-03-22
|
//Modified: 03-03-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestColumnar{
|
public class TestColumnar{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,18 +2,18 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-31-22
|
// Created: 01-31-22
|
||||||
//Modified: 02-17-22
|
//Modified: 02-17-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class TestHill{
|
public class TestHill{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 07-28-21
|
// Created: 07-28-21
|
||||||
//Modified: 01-04-22
|
//Modified: 01-04-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 07-30-21
|
// Created: 07-30-21
|
||||||
//Modified: 01-04-22
|
//Modified: 01-04-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class TestPlayfair{
|
public class TestPlayfair{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 01-04-22
|
// Created: 01-04-22
|
||||||
//Modified: 01-09-22
|
//Modified: 01-09-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class TestPolybiusSquare{
|
public class TestPolybiusSquare{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,16 +2,16 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 03-21-22
|
// Created: 03-21-22
|
||||||
//Modified: 03-22-22
|
//Modified: 03-22-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidBaseException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidBaseException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
|
||||||
|
|
||||||
public class TestRailFence{
|
public class TestRailFence{
|
||||||
@Test
|
@Test
|
||||||
@@ -2,18 +2,18 @@
|
|||||||
//Mattrixwv
|
//Mattrixwv
|
||||||
// Created: 03-03-22
|
// Created: 03-03-22
|
||||||
//Modified: 03-03-22
|
//Modified: 03-03-22
|
||||||
package com.mattrixwv.CipherStreamJava.polySubstitution;
|
package com.mattrixwv.cipherstream.polysubstitution;
|
||||||
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidBaseException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidCharacterException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidInputException;
|
|
||||||
import com.mattrixwv.CipherStreamJava.exceptions.InvalidKeywordException;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidBaseException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidCharacterException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidInputException;
|
||||||
|
import com.mattrixwv.cipherstream.exceptions.InvalidKeywordException;
|
||||||
|
|
||||||
|
|
||||||
public class TestTrifid{
|
public class TestTrifid{
|
||||||
@Test
|
@Test
|
||||||
Reference in New Issue
Block a user