我怎样才能解密这种加密程序? [英] How can I decrypt this encryption routine?

查看:142
本文介绍了我怎样才能解密这种加密程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何解密以下加密程序?基本上我有一个加密密钥,我进入它,然后我被要求进入,然后被加密的6字母组成的单词。我将如何解密呢?
谢谢

加密:

 推EDX
      推ECX
      不EAX
      添加EAX,0×04
      MOV EDX,EAX
      流行EAX
      XOR EAX,EDX
      流行EDX
      ROL人,1
      ROL人,1
      ROL人,1
      子人,0X02
      RET


解决方案

编辑:为新的code,见底

这code是怪异,但它似乎是在做这样的事情:(未测试)

 字符加密(CHAR一,INT C)
{
    INT T = 4 +〜一; //将不和ADD
    INT T2 =(C ^ T)及0xFF的; //异或
    INT T3 =((T2&下; 3;)|(T2>→5))及0xFF的; //三个ROL的
    回报(炭)(T3 - 2); //将SUB
}

相应的解密会,我认为是这样的:(未测试)

 字符解密(CHAR一,INT C)
{
    INT T =(A + 2)及0xFF的;
    INT T2 =((T>→3)|(T&所述;小于5))及0xFF的;
    INT T3 = T2 ^ C;
    回报(炭)〜(T3 - 4);
}

其中在大会可以是这样的:(没有测试过,并没有杂波)

 加人,2
ROR人,3;或三次ROR人,1
异人,CL
子人,4
没有人
RET

或者你可以在多为32位做到这一点:(也未测试)

 添加EAX,2
ROR人,3
XOR EAX,ECX
子EAX,4
不EAX
MOVZX EAX,人;或只是忽略一切,但低字节
RET

什么都没有了测试,但是我用了一般的策略是这样的:弄清楚了code是干什么的,然后一步一步地思考如何解开这些东西,从末端开始。如果有3留下的旋转,使右移通过3.如果加4,减4 XOR和NOT都是自己的逆。


由于我拿到了钥匙,混淆了数据我听错了。其实,这应该是这样的:(也未测试)

 ; EAX = EKEY,CL = CHAR
decryptB:
  加ECX,2 //撤消子2
  ROR CL,3 //撤消ROL
  不EAX //其实并不
  添加EAX,4 //其实也加4
  XOR EAX,ECX //撤消XOR
  RET

由于该键完成操作应该的的是逆。

Does anyone know how to decrypt the following encryption routine? Basically I have an encryption key, I enter it, then I am asked to enter a 6 letter word which then gets encrypted. How shall I decrypt this? Thanks

encrypt:

      push edx 
      push ecx 
      not eax 
      add eax,0x04 
      mov edx,eax 
      pop eax 
      xor eax,edx 
      pop edx 
      rol al,1 
      rol al,1
      rol al,1 
      sub al,0x02 
      ret 

解决方案

edit: for the new code, see bottom

This code is weird, but it seems to be doing something like this: (not tested)

char encrypt(char a, int c)
{
    int t = 4 + ~a;        // the NOT and the ADD
    int t2 = (c ^ t) & 0xFF;  // the XOR
    int t3 = ((t2 << 3) | (t2 >> 5)) & 0xFF;  // the three ROL's
    return (char)(t3 - 2);   // the SUB
}

The corresponding decrypt would, I think, look like this: (not tested)

char decrypt(char a, int c)
{
    int t = (a + 2) & 0xFF;
    int t2 = ((t >> 3) | (t << 5)) & 0xFF;
    int t3 = t2 ^ c;
    return (char)~(t3 - 4);
}

Which in assembly could be this: (not tested, and no clutter)

add al, 2
ror al, 3   ; or three times ror al, 1
xor al, cl
sub al, 4
not al
ret

Or you could do it in "mostly 32 bit": (also not tested)

add eax, 2
ror al, 3
xor eax, ecx
sub eax, 4
not eax
movzx eax, al  ; or just ignore everything but the low byte
ret

Nothing at all was tested, but the general strategy I used is this: figure out what the code is doing, and then step by step think about how to undo these things, starting at the end. If there is a rotate left by 3, make a rotate right by 3. If they add 4, subtract 4. XOR and NOT are their own inverses.


Because I got the key and the data mixed up I got it wrong. Actually, it should be this: (also not tested)

; eax = EKey, cl = char
decryptB:
  add ecx, 2   // undo sub 2
  ror cl, 3    // undo rol
  not eax      // actually do not
  add eax, 4   // actually do add 4
  xor eax, ecx // undo xor
  ret

Because the operations done on the key should not be the inverses.

这篇关于我怎样才能解密这种加密程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆