The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Player_0 on March 03, 2007, 05:36:12 PM

Title: Question about using encrypted code...
Post by: Player_0 on March 03, 2007, 05:36:12 PM
Hello all!

Im new to assembly and am slowly getting used to it. Right now im learning using MASM. The compiled code looks so "clean" compared to other languages. I have a question about using encrypted code in a program. Is there anyway to write a section or algorithm that will compile into encrypted form? Or do you have to build another program to output the encrypted hex values and copy paste them into a dd variable block or something? Basically I want to open my program in a debugger and see a couple lines that are encrypted already before the program runs. This seems like a really basic question but I need help seeing how it should be done.
Title: Re: Question about using encrypted code...
Post by: Tedd on March 05, 2007, 02:19:18 PM
This is usually achieved through a "packer" - a program that encrypts and/or compresses your exe - which makes the code much harder to disassemble/debug.
If you want to do it yourself then you can try encrypting the code section, including it as data (either in the data section or code section) and then have the code necessary to decrypt it in memory (which will, of course, need to be non-encrypted in order to run.)
A small 'warning' - no matter how much you attempt to encrypt/hide your code, you can't make it impossible to find (unless you make it impossible to run; but you want it to run!) What this means is that you can only ever make it difficult, but not impossible, so it will slow down some and maybe even stop others, but don't place too much secrecy in it.