void encrypt_chars(int length)
{
char temp_char;
for (int i = 0; i < length; i++)
{
temp_char = OChars[i];
__asm {
push eax
push ecx
movzx ecx, temp_char
call encrypt_nn
mov temp_char, al
pop ecx
pop eax
}
EChars[i] = temp_char;
}
return;
__asm {
encrypt_nn:
mov eax, ecx
inc eax
ret
}
The encryption part is fine, but I thought I would copy and paste the code to the decryption and instead of incrementing I would decrement the values, so that it would go back and decrypt the data
//---------------------------------------------------------------------------------------------------------------
//----------------- DECRYPTION ROUTINES -------------------------------------------------------------------------
//
void decrypt_chars(int length)
{
char temp_char;
for (int i = 0; i < length; i--)
{
temp_char = OChars[i];
__asm {
push eax
push ecx
movzx ecx, temp_char
call encrypt_nn
mov temp_char, al
pop ecx
pop eax
}
EChars[i] = temp_char;
}
return;
}