Chr*_*ini 1 x86 assembly masm xor
你如何异化存储在EAX中的值?
问题出在这一行:
xor eax, key
Run Code Online (Sandbox Code Playgroud)
EAX包含我想要XOR的值的地址.我怎么能做到这一点?我虽然会有以下几点:
xor [eax], key
Run Code Online (Sandbox Code Playgroud)
但这不起作用(语法错误)
decrypt proc startAddress:DWORD , sizeOfSegment:DWORD , key:DWORD
xor ecx, ecx ; clear the ecx register for the counter
mov eax, startAddress ; copy the start address to eax
.while ecx < sizeOfSegment ; loop through the code
xor eax, key ; XOR decrypt the word
inc eax
inc ecx
.endw
ret
decrypt endp
Run Code Online (Sandbox Code Playgroud)
你说你做的......
xor eax, key ; XOR decrypt the word
Run Code Online (Sandbox Code Playgroud)
...但我猜这是一个错字,而你实际上是在尝试......
xor [eax], key ; XOR decrypt the word
Run Code Online (Sandbox Code Playgroud)
这不起作用的原因是它key
不是一个寄存器:它可能,我不知道,是类似的东西的同义词[ebp+4]
.
x86(不仅仅是MASM,还有nasm:x86指令集)允许寄存器到寄存器和寄存器到存储器以及存储器到寄存器的操作数,但不允许存储器到存储器.
因此,您需要将密钥加载到一些备用寄存器中,例如:
mov eax, startAddress
mov ebx, key ; move key into a register, which can be XORed with [eax]
.while ecx < sizeOfSegment
xor [eax], ebx
Run Code Online (Sandbox Code Playgroud)
在一个单独的问题上,你真的想做inc eax
或应该做什么add eax,4
?我的意思是,你说"XOR解密这个词":你的意思是"字","字节",还是"双字"?
归档时间: |
|
查看次数: |
1569 次 |
最近记录: |