LZ: Self Encrypting Programs


[Prev][Next][Index][Thread]

LZ: Self Encrypting Programs



I had a thought a while ago, about making a program self encrypting (and 
decrypting) so that while the program is running, the code is decrypted and 
in the actual opcodes.  When the program exits, it encrypts itself, thereby 
making it virtually impossible to decompile unless somebody has a lot of 
time on their hands, as well as hiding the location of variables 
(passwords and such).  Tell me what you think!

#include ti-85.h

*org 0
db "(whatever)", 0
;start of decryption
 ld    hl, Encrypt_loop
 ld    de, Encrypted_byte
 sbc   hl, de
 ex    de, hl
 push  de
 ld    bc, (PROGRAM_ADDR)
 add   hl, bc
 push  hl
 ld    a, (hl)
 cp    $0f
 jr    Z, Prog_Start
Decrypt_loop:
 ld    a, (hl)
 xor   $ff
 ld    (hl), a
 inc   hl
 dec   de
 jr    nz, Decrypt_loop
 jr    Prog_Start
Encypted_byte:
db $0f
Prog_Start:


Follow-Ups: