mirror of
https://bitbucket.org/Mattrixwv/cipherstream.git
synced 2025-12-06 18:33:58 -05:00
Fixed decoding bug that would cause incorrect messages to be output
This commit is contained in:
@@ -265,10 +265,10 @@ std::string Playfair::decode(){
|
|||||||
--col2;
|
--col2;
|
||||||
|
|
||||||
//Wrap around
|
//Wrap around
|
||||||
if(col1 > 4){
|
if(col1 < 0){
|
||||||
col1 += 5;
|
col1 += 5;
|
||||||
}
|
}
|
||||||
if(col2 > 4){
|
if(col2 < 0){
|
||||||
col2 += 5;
|
col2 += 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,10 +278,10 @@ std::string Playfair::decode(){
|
|||||||
--row2;
|
--row2;
|
||||||
|
|
||||||
//Wrap around
|
//Wrap around
|
||||||
if(row1 > 4){
|
if(row1 < 0){
|
||||||
row1 += 5;
|
row1 += 5;
|
||||||
}
|
}
|
||||||
if(row2 > 4){
|
if(row2 < 0){
|
||||||
row2 += 4;
|
row2 += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user