From b9e4efa6c0067757dca9f5bee65a9a2f3e9f51a2 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Wed, 28 Jul 2021 20:57:31 -0400 Subject: [PATCH] Updated Vigenere to work with Autokey --- .../mattrixwv/CipherStreamJava/Vigenere.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/mattrixwv/CipherStreamJava/Vigenere.java b/src/main/java/mattrixwv/CipherStreamJava/Vigenere.java index 5e97064..5b07e45 100644 --- a/src/main/java/mattrixwv/CipherStreamJava/Vigenere.java +++ b/src/main/java/mattrixwv/CipherStreamJava/Vigenere.java @@ -9,13 +9,13 @@ import java.util.ArrayList; public class Vigenere{ public static final String version = "1.0"; //The current library's version number - private String inputString; //This is the string that needs encoded/decoded - private String outputString; //This is the string that is output after encoding/decoding - private String keyword; //This is the keyword that is resposible for determining the offsets that you change each character by - private ArrayList offset; //Holds the offsets coputed from each character in the keyword + protected String inputString; //This is the string that needs encoded/decoded + protected String outputString; //This is the string that is output after encoding/decoding + protected String keyword; //This is the keyword that is resposible for determining the offsets that you change each character by + protected ArrayList offset; //Holds the offsets coputed from each character in the keyword //Uses keyword to calculate the offset for the Caesar cipher for each character - private void setOffset(){ + protected void setOffset(){ //Reserve the correct size to increase speed later offset.ensureCapacity(keyword.length()); @@ -26,7 +26,7 @@ public class Vigenere{ } } //Sets inputString - private void setInputString(String input){ + protected void setInputString(String input){ //Convert all letters to uppercase input = input.toUpperCase(); //Remove all characters except capital letters @@ -35,7 +35,7 @@ public class Vigenere{ inputString = input; } //Sets keyword - private void setKeyword(String key) throws Exception{ + protected void setKeyword(String key) throws Exception{ //Convert all letters to uppercase key = key.toUpperCase(); //Remove all characters except capital letters @@ -52,7 +52,7 @@ public class Vigenere{ } } //Encodes inputString and stores the result in outputString - private String encode(){ + protected String encode(){ StringBuilder output = new StringBuilder(); //Step through every character in the inputString and advance it the correct amount, according to offset @@ -72,7 +72,7 @@ public class Vigenere{ return outputString; } //Decodes inputString and stores the result in outputString - private String decode(){ + protected String decode(){ StringBuilder output = new StringBuilder(); //Step through every character in the inputString and advance it the correct amount, according to offset