Jump to content
Tuts 4 You

xor encryption


Busted

Recommended Posts

Posted

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, 15
mov ecx, 20
xor eax, ecx
mov eax, offset Buffer
xor eax, eax
xor ecx, ecx

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

Cheers, Tipidy

Posted
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, 15
mov ecx, 20
xor eax, ecx
mov eax, offset Buffer
xor eax, eax
xor 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 15
mov ecx, 20 ; ecx now 20
xor eax, ecx ; eax now is 15 ^ 20
mov eax, offset Buffer ; eax is now pointing to the buffer (you just killed the xor result here)
xor eax, eax ; eax = 0
xor ecx, ecx ; ecx = 0

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

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

think you need to learn assembly code a bit more :)

Posted

@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 buffer
mov dword ptr [eax], (15 xor 20)

Cheers, Tipidy

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...