std::string sortedKey = key;
std::sort ( sortedKey.begin(), sortedKey.end() );
int letIndex=0;
int update=0;
//num of rows is the rows needed to fill out the plaintext in the keyword
for(int i = 0 ; i < NumOfRows;i++){
std::string sortedKeyCopy = sortedKey ;
for(char c : key){
size_t io = sortedKeyCopy.find(c);
int index = (int) io;
index+=update;
if(index >= t ){
continue;
}
sortedKeyCopy[io]=' ';
//raw text is the encrypted text we're trying to decrypt
decryptedText.push_back(rawText[index]);
}
update+=keyLength;
}
but this code messes up the decryption in the final letters
i have no idea why,does anyone know?