From 5cc3b935c1f00300b18d22231992a548d1505d82 Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Wed, 16 May 2018 01:15:54 -0400 Subject: [PATCH] Fixed decoding bug that would cause incorrect messages to be output --- SourceFiles/Playfair.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SourceFiles/Playfair.cpp b/SourceFiles/Playfair.cpp index 968514f..808cd64 100644 --- a/SourceFiles/Playfair.cpp +++ b/SourceFiles/Playfair.cpp @@ -265,10 +265,10 @@ std::string Playfair::decode(){ --col2; //Wrap around - if(col1 > 4){ + if(col1 < 0){ col1 += 5; } - if(col2 > 4){ + if(col2 < 0){ col2 += 5; } } @@ -278,10 +278,10 @@ std::string Playfair::decode(){ --row2; //Wrap around - if(row1 > 4){ + if(row1 < 0){ row1 += 5; } - if(row2 > 4){ + if(row2 < 0){ row2 += 4; } }