Updated to fix errors with not clearing strings during encoding/decoding

This commit is contained in:
2018-05-14 13:46:37 -04:00
parent dc85d6b5bc
commit c8c56ef159
4 changed files with 10 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ Autokey::~Autokey(){
* @param key The keyword used for the cipher
* @param input The string that you wish to encode
*/
void Autokey::encodeSet(std::string& key, std::string input){
void Autokey::encodeSet(std::string key, std::string input){
//Remove all unneccessary elements from the key
Vigenere::setKeyword(key);
key = Vigenere::getKeyword();
@@ -57,10 +57,11 @@ void Autokey::encodeSet(std::string& key, std::string input){
* @param key The keyword used for the cipher
* @param input The string that you wish to decode
*/
void Autokey::decodeSet(std::string& key, std::string input){
void Autokey::decodeSet(std::string key, std::string input){
//Remove all unneccessary elements from the key
Vigenere::setKeyword(key);
//Remove all unneccessary elements from the input
inputString = "";
Vigenere::setInputString(input);
}
@@ -133,4 +134,4 @@ std::string Autokey::decode(std::string key, std::string input){
setInputString(input);
decodeSet(key, input); //Decoding is a bit different because part of the key is also part of the original message
return Autokey::decode();
}
}