Fixed decoding bug that would cause incorrect messages to be output

This commit is contained in:
2018-05-16 01:15:54 -04:00
parent ac396e281a
commit 5cc3b935c1

View File

@@ -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;
} }
} }