Would this decryption decrypt this encryption?

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

decryption:

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.