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

时间:2014-04-03 02:05:26

标签: c++ assembly

我在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
} 

1 个答案:

答案 0 :(得分:0)

解密的最佳线索(和问题一般):

撤消所有内容

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

因此,如果代码以:

结尾
inc eax
ret

你从

开始
[load the return in eax]
dec eax

等等。

相关问题