diff --git a/SourceFiles/Vigenere.cpp b/SourceFiles/Vigenere.cpp index 9080e58..b7d2bfd 100644 --- a/SourceFiles/Vigenere.cpp +++ b/SourceFiles/Vigenere.cpp @@ -79,6 +79,8 @@ void Vigenere::setKeyword(std::string key){ } //If it is not a letter ignore it } + //Make sure offset is empty before adding to it + offset.clear(); setOffset(); } @@ -96,8 +98,6 @@ std::string Vigenere::getKeyword() const{ * */ void Vigenere::setOffset(){ - //Make sure offset is empty - offset.clear(); //Reserve the correct size to increase speed later offset.reserve(keyword.size()); @@ -123,7 +123,6 @@ std::vector Vigenere::getOffsets() const{ * @return The encoded message */ std::string Vigenere::encode(){ - outputString = ""; //Reserve the correct size for the output string to increase speed for longer messages outputString.reserve(inputString.size()); @@ -168,7 +167,6 @@ std::string Vigenere::encode(std::string key, std::string input){ * @return The decoded message */ std::string Vigenere::decode(){ - outputString = ""; //Reserve the correct size for the output string to increase speed for longer messages outputString.reserve(inputString.size());