mirror of
https://bitbucket.org/Mattrixwv/cipherstream.git
synced 2025-12-06 18:33:58 -05:00
Fixed to work correctly with new Vigenere class functions
This commit is contained in:
@@ -48,6 +48,7 @@ void Autokey::encodeSet(std::string key, std::string input){
|
|||||||
//Set the new Keyword
|
//Set the new Keyword
|
||||||
keyword = key;
|
keyword = key;
|
||||||
//Make sure to update the offset
|
//Make sure to update the offset
|
||||||
|
offset.clear();
|
||||||
setOffset();
|
setOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +79,7 @@ std::string Autokey::decode(){
|
|||||||
std::string key = keyword;
|
std::string key = keyword;
|
||||||
unsigned int keyLength = keyword.size();
|
unsigned int keyLength = keyword.size();
|
||||||
for(int cnt = 0;(key.size() * cnt) < inputString.size();++cnt){
|
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
|
//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
|
//This also allows the key to be longer than the message
|
||||||
if(keyword.size() == keyLength){
|
if(keyword.size() == keyLength){
|
||||||
@@ -103,6 +105,7 @@ std::string Autokey::decode(){
|
|||||||
output += temp;
|
output += temp;
|
||||||
keyword += temp;
|
keyword += temp;
|
||||||
//Make sure to update the offsets
|
//Make sure to update the offsets
|
||||||
|
offset.clear();
|
||||||
setOffset();
|
setOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user