gpt4 book ai didi

c++ - 程序集解密/逆向? XOR 是一个问题吗?

转载 作者:搜寻专家 更新时间:2023-10-31 00:39:28 29 4
gpt4 key购买 nike

我有一个代码函数,我试图扭转它的影响,但没有成功。我原来的功能是:

          ror al,1                      // rotates the al part of the eax register (the Ekey) bitwise by 1 bit, as 1 mod 8 = 1 (al = 2D)
ror al,1 // moves the rightmost bit from al (the end of the Ekey) and shifts everything along
ror al,1 // rotates al bitwise by 1 bit, as 1 mod 8 = 1 (al = 4B)
ror al,1 // rotates the end 8 bits of the Ekey bitwise by 1 bit, as 1 mod 8 = 1 (al = A5)
push ecx // preserves the value of the encrypted character by pushing it on the stack, the stack pointer decrements by 4 to allow this
not eax // completes the ones' complement on the Ekey, toggling the bits
mov edx,eax // copies the current value of the Ekey register and places it in edx, for holding
pop eax // restores original register value from stack
xor eax,edx // completes a bitwise exclusive or on the Ekey, with the previous value of the Ekey that was stored in edx
ror al,1 // rotates the last 8 bits of the Ekey bitwise by 1 bit, as 1 mod 8 = 1
ror al,1 // rotates al bitwise by 1 bit, as 1 mod 8 = 1
not eax // completes the ones' complement on the Ekey value, 'flipping' eax entirely
add eax,0x20 // adds the hex value of 20 (32 in base 10) to the current value in the Ekey

我必须只反转上面代码的效果,而不是每一行。我已经尝试过各种事情...尝试 1(这是错误的):

      sub eax, 0x20
not eax
rol al, 2
xor ecx, eax
push eax
mov eax, edx
not eax
pop ecx
rol al, 4

我的第二次尝试如下:

      sub eax, 0x20
not eax
rol al, 2
not eax
xor ecx, eax

这有什么问题...异或的效果可以逆转吗?

最佳答案

明显的顺序是这样的:

; inputs:
; edx: ekey
; eax: "encrypted" word
;
not eax
rol al, 1
rol al, 1
not edx
xor eax, edx

在我看来,原始代码也不必要地复杂。我想我会写一些更像这样的东西:

not eax
xchg eax, ecx
xor eax, ecx
rol al, 1
rol al, 1
not eax

我认为还可以进一步简化,但我必须仔细考虑才能确定。

关于c++ - 程序集解密/逆向? XOR 是一个问题吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16134765/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com