News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Question about using encrypted code...

Started by Player_0, March 03, 2007, 05:36:12 PM

Previous topic - Next topic

Player_0

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.

Tedd

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.
No snowflake in an avalanche feels responsible.