Would this decryption decrypt this encryption?

push eax
and eax,0xAA
not al
mov edx,eax
pop eax
and eax,0x55
xor ecx,edx
xor ecx,eax
rol cl,1
rol cl,1
mov eax,ecx
sub al,0x20


add al, 0x20
mov eax, ecx
ror cl, 1
ror cl, 1
xor ecx, eax
xor ecx, edx
and eax, 0x55
pop eax
mov edx, eax
not al
and eax, 0xAA
push eax

5 Years
Discussion Span
Last Post by Assembly Guy

No. Take a look at the and eax,0xAA. Let's use the example that ax = 123d which is 01111011 in binary. With encryption using just the aforementioned and line, ax would undergo the following changes:

ax = 01111011 & 10101010
   = 00101010

...and with 'decryption' using the same and operation:

ax = 00101010 & 10101010
   = 00101010

So as you can see, with the example of ax = 123d, an and operation cannot be undone with an identical and operation, thus at least that part of your code wouldn't work. There are more parts which won't work, but you're on the right track with flipping your ror to rol and add to sub etc.

So to answer your question, no the decryption does not decrypt the encryption. Also, when you post code, please use the Code button at the top of the post text box.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.