I am doing a decryption program. I've been looking and trying to figure this out, but I don't see anything. So when I decrypt such as 9adwrqxvni0348&4#9
it comes out fine, but when I have an offset of 11
or more it decrypts all but the last character. No matter what the offset past 11
is the last character is that same. I just now stuck all letters in, and they work. It is just the last number character that does not work past 11
.
for (int count = 0; count < length; count++)
{
if (msg[count] >= 'a' && msg[count] <= 'z')//Letter wraping
{
dmsg += ((msg[count] - 'a' - offset + 26) % 26) + 'a';
}
else if (msg[count] >= '0' && msg[count] <= '9')//Number wraping
{
dmsg += (abs(msg[count] - '0' - offset + 10) % 10) + '0';
}
}