Fixed to work correctly with new Vigenere class functions

This commit is contained in:
2018-05-14 15:46:36 -04:00
parent c8c56ef159
commit fec425ae29

View File

@@ -48,6 +48,7 @@ void Autokey::encodeSet(std::string key, std::string input){
//Set the new Keyword
keyword = key;
//Make sure to update the offset
offset.clear();
setOffset();
}
@@ -78,6 +79,7 @@ std::string Autokey::decode(){
std::string key = keyword;
unsigned int keyLength = keyword.size();
for(int cnt = 0;(key.size() * cnt) < inputString.size();++cnt){
outputString = "";
//Make sure you are not going to run out of bounds with the keyword
//This also allows the key to be longer than the message
if(keyword.size() == keyLength){
@@ -103,6 +105,7 @@ std::string Autokey::decode(){
output += temp;
keyword += temp;
//Make sure to update the offsets
offset.clear();
setOffset();
}