One fairly interesting application of self-modifying code is in
copy protection. It's possible with some knowledge of
assembler and good
debugger and/or
disassembler to change the code of a
crippled
shareware (or a commercial) program to unlock all the features. Apparently
1 self-modifying self-encrypting code is one of the techiniques against these brute force
cracks. Essentially the code to the advanced features of the program is encrypted. The
license or the
serial number would provide the
unencryption key which would make it possible to decrypt the code which contains the more advanced features. This would make cracking practically impossible.
1I must admit, this is little more than theory to me. This information was gleaned from a russian book called Theory and Psychology of Hacker Attacks. If I have messed up somewhere please let me know and I'll correct it.