需要帮助解密我的汇编程序

Need help decrypting my assembly program

本文关键字:我的 汇编程序 解密 帮助      更新时间:2023-10-16

我在C++和ASM中都有这个加密程序,该程序具有加密例程,但我需要知道它的解密例程应该是什么样子的。这是代码:

//-ENCRYPTION ROUTINES 
void encrypt_chars (int length, char EKey)
{   char temp_char;             
    for (int i = 0; i < length; i++)    
    {   temp_char = OChars [i];     
        __asm {             
            push   eax      
            push   ecx      
            movzx  ecx,temp_char     
            lea    eax,EKey      
            call   encrypt       
            mov    temp_char,al  
            pop    ecx      
            pop    eax      
        }
        EChars [i] = temp_char;         
    }
   return;
    // --- Start of Assembly code
   __asm {
    encrypt5: push eax 
          mov  al,byte ptr [eax]
      push ecx 
          and eax,0x7C 
          ror eax,1 
          ror eax,1 
          inc eax 
          mov edx,eax 
          pop ecx
      pop eax
      mov byte ptr [eax],dl
          xor edx,ecx 
          mov eax,edx 
          rol al,1 
          ret 
    encrypt:
        mov eax,ecx     
        inc eax         
        ret
    }
    //--- End of Assembly code
} 

解密的最佳线索(和问题一样笼统):

撤消所有操作

我想该代码中的每个指令都有一个保守的相反(除非它在数据中被破坏,但是嘿)

因此,如果代码以以下结尾:

inc eax
ret

你从

[load the return in eax]
dec eax

等等。