mirror of
https://bitbucket.org/Mattrixwv/cipherstream.git
synced 2025-12-06 18:33:58 -05:00
Fixed bug where multiple operations before reset called threw error
This commit is contained in:
@@ -100,10 +100,10 @@ void Playfair::createGrid(){
|
|||||||
//Put a check here that row == 5. If it doesn't then there is a problem
|
//Put a check here that row == 5. If it doesn't then there is a problem
|
||||||
//TODO: Make this a propper exception throw rather than this
|
//TODO: Make this a propper exception throw rather than this
|
||||||
if(row < 5){
|
if(row < 5){
|
||||||
throw invalidGrid("smaller", row);
|
throw invalidGrid("small", row);
|
||||||
}
|
}
|
||||||
else if(row > 5){
|
else if(row > 5){
|
||||||
throw invalidGrid("larger", row);
|
throw invalidGrid("large", row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +252,8 @@ std::string Playfair::encode(){
|
|||||||
* @return The encoded message
|
* @return The encoded message
|
||||||
*/
|
*/
|
||||||
std::string Playfair::encode(std::string keyword, std::string input){
|
std::string Playfair::encode(std::string keyword, std::string input){
|
||||||
|
//Reset the variables every time, just in case
|
||||||
|
reset();
|
||||||
try{
|
try{
|
||||||
setKeyword(keyword);
|
setKeyword(keyword);
|
||||||
}
|
}
|
||||||
@@ -346,6 +348,8 @@ std::string Playfair::decode(){
|
|||||||
* @return The decoded message
|
* @return The decoded message
|
||||||
*/
|
*/
|
||||||
std::string Playfair::decode(std::string keyword, std::string input){
|
std::string Playfair::decode(std::string keyword, std::string input){
|
||||||
|
//Reset the variables every time, just in case
|
||||||
|
reset();
|
||||||
try{
|
try{
|
||||||
setKeyword(keyword);
|
setKeyword(keyword);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user