Simple implementation of xor dynamic encryption assembly code

Source: Internet
Author: User

Dark Group sulton residual zero

The simple implementation of XOR dynamic encryption first of all, I would like to express my special thanks to Yan binlang's great guidance to me.

Then, simply put, the code is followed by comments, which should be detailed! 4-byte Encryption

The efficiency is good. In a loopd loop, an exclusive or encrypted Key is added with 2, so that each 4 bytes is converted into an exclusive or value.

My blog is http://hi.baidu.com/

Pushad // all registers into the stack

Call xxxxxxxx // The Next line of code in CALL is pop ebx.

Pop ebx // an EBX pop-up stack

Sub ebx, xxxxxxxx // xxxxxxxx represents the memory address of the last row, that is, the pop ebx row (before the relocation)

Add ebx, xxxxxxxx // xxxxxxxx indicates the address before the feature is relocated.

Mov ecx, 5 // 5 cycles

Mov edx, 12345678 // pass 12345678 to EDX as the initialization KEY of the first loop

Mov eax, dword ptr [ebx] // transfers the memory location of ebx to eax

Xor eax, edx // encrypt the result of XOR encryption between EDX and EAX in EAX

Mov dword ptr [ebx], eax // transfers encrypted content to ebx

Add ebx, 4 // The memory address of ebx plus 4 bytes

Add edx, 2 // dynamically encrypt the edx value plus 2 cycles plus 2 at a time

Loopd short xxxxxxxx // jump to mov eax, dword ptr [ebx]. This is a loop. The number of loops is shown in the figure above. 5 indicates 5 loops.

Popad // all register fetch Stack

Original jmp entry point // jump to the original entry point

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.