From fec425ae298796dc75d2e299492ca443295504d4 Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Mon, 14 May 2018 15:46:36 -0400 Subject: [PATCH] Fixed to work correctly with new Vigenere class functions --- SourceFiles/Autokey.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SourceFiles/Autokey.cpp b/SourceFiles/Autokey.cpp index 888db44..aa487e2 100644 --- a/SourceFiles/Autokey.cpp +++ b/SourceFiles/Autokey.cpp @@ -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(); }