Tuts 4 You

# xor encryption

## Recommended Posts

Hi all,

Whilst I am coding my first keygen me, I thought I might experiment with a bit of simple xor encryption. I have done a bit of research and want to double check to see if I understand this, example code below:

`mov eax, 15mov ecx, 20xor eax, ecxmov eax, offset Bufferxor eax, eaxxor ecx, ecx`

Now... 15 xor 20 = 27, therefore would 27 be stored in the buffer according to this code?!?

Cheers, Tipidy

Hi all,

Whilst I am coding my first keygen me, I thought I might experiment with a bit of simple xor encryption. I have done a bit of research and want to double check to see if I understand this, example code below:

`mov eax, 15mov ecx, 20xor eax, ecxmov eax, offset Bufferxor eax, eaxxor ecx, ecx`

Now... 15 xor 20 = 27, therefore would 27 be stored in the buffer according to this code?!?

Cheers, Tipidy

erm nope it wont... considering you haven't even written to the buffer

`mov eax, 15					 ; eax now 15mov ecx, 20					 ; ecx now 20xor eax, ecx					; eax now is 15 ^ 20mov eax, offset Buffer	  ; eax is now pointing to the buffer (you just killed the xor result here)xor eax, eax					; eax = 0xor ecx, ecx					; ecx = 0`

you to write it into the buffer (assuming the buffer is 4kb or more..) like this

`mov eax, offset Buffermov dword ptr [eax], (15 xor 20); this is the hard coded way`

think you need to learn assembly code a bit more

@evlncrn8

Thank you, I should of tested some code before posting it my bad. But yeah your right, I do still have a bit to learn on assembly but I am getting there slowly

`mov eax, offset buffermov dword ptr [eax], (15 xor 20)`

Cheers, Tipidy