Re: LZ: Self Encrypting Programs
[Prev][Next][Index][Thread]
Re: LZ: Self Encrypting Programs
I had written a part of the code which would re-encrypt the code upon
exiting the program, but for some reason it didn't get sent with the rest.
That is the reason that I pushed both de and hl into the stack, because I
would just reload them before exiting and use them to easily encrypt the
program again without all sorts of nasty loads and exchanges.
Thanks,
Michael Wyman
wyma0012@gold.tc.umn.edu
_____________________________________
On Mon, 2 Dec 1996 19:20:21 -0600 (CST),
list-zshell@lists.ticalc.org wrote...
>
>Having a run-time self encrypting program is fun and easy!
>
>The only part of the code that isn't encrypted is a small loader at the
>begining. All it does is go through the whole program and XOR it with a
>byte stored in memory. Because you are XORing, the procedure to decrypt
>and encrypt are the same. There should'nt be any complications with
>ZShell as long as you set the checksum update bit and everything. The
>loop to do this is really small, you'll probably only add about just over
>20 bytes or so. The only problem is that unlike a PC program, where you
>just have to decrypt and not worry about it because you are only
>decrypting the copy in memory and not the one on the disk. You can't
>just do this on the 85 because the copy in memory is the only copy you
>have. A simple fix for this is to have a second byte in the unencrypted
>loader that is a flag as to weither the program is currently encrypted or
>not. Then if the program is killed for some reason (which really
>shouldn't happen in the 85 enviroment) then if run again, it will still
>work properlly. Another improvement that is so easy that it is worth
>doing is to have it change the encryption byte that it uses to XOR after
>everytime you decrypt. This is ok, as long as you change it only when
>the program is decrypted and you use the same one to decrypt as you
>encrypted with. If you want to get fancy you can use multi-byte keys,
>but that's kinda a waste. Just remember to re-encrypt the program
>before you exit, otherwise it won't work correctly. Anyway, hope this
>helps.
>
>This is the word of Site, the site of sites.
>
>