LifeCode 1.00
(c) 2001 Kozma Laszlo


0.Contents.
1.What is LifeCode 1.00.?
2.How to use LifeCode 1.00?
3.Parameters.
4.Systems.
5.The algorithm.
6.Technical.
7.Checksums.
8.Error messages.
9.Tips on security.
10.Contact me.
11.Registering.
12.Legal stuff.

1.What is LifeCode 1.00.?
LifeCode is a file encryptor and decryptor. With LifeCode you can encrypt your 
files with a password. 
Then, when you need the file you can decrypt it with the same password. 
You can use it to encrypt archives, encrypt files you want to send on e-mail, 
or any other files you want.
It is very simple to use, and it should run on all computers. 
It's user interface is as simple as possible, I wanted to make 
the program compact, easy to use and fast.

2.How to use LifeCode 1.00.?
When you execute lifecode.exe, a menu appears, containing three elements:
Encrypt, Decrypt and Quit. You can browse using up and down keys, 
and select with enter.
'Quit' is obvious, it quits the program without asking any questions.
(in Win32 probably you will have to click on the X, after you see 
'lifecode.exe Finished...' on the title bar.)
Encrypt: this means encrypting a file. You will be asked 'Inputfile' 
which is the name of the file to be encrypted. You can enter full path, 
but the easiest way is to copy lifecode.exe to the directory with your files, 
in this case you only have to enter the file name.
The same goes for 'Outputfile' which is the name of the file which will 
contain your encrypted data.
If Outputfile is an existing file it will be overwritten without asking any 
questions.
Then you are asked to enter your password twice.
After this encrypting begins.
Decrypt: decrypting the previously encrypted file. 'Inputfile' now is the file 
containing encrypted data, 'Outputfile' is the name of the file, which will 
contain your restored, original data.
The password has to be exactly the same as when you encrypted the file.
If you forget your password noone can decrypt the file (not even me).

3.Parameters.
There is only one command line parameter. If you start LifeCode with 
the parameter 't' (like: lifecode t ), it will run in 'text only mode'. 
This means that it won't show progress and key generation in graphic mode.
This way it will run faster, and it will also run on computers 
whithout EGA-compatible display (if there are any of these today).
The progress is shown in text mode with dots. The full process takes 10 dots.

4.Systems.
As I said LifeCode 1.00 should run on all machines without any problems. 
I use it on a 40 MHz and a 566 MHz computer, and it works perfectly on both. 
You can also use it in Win95, 98, 2000, or whatever.
You can run it in a window, but in graphics mode it will turn to full screen.
Anyway, I advice to run it in MS-DOS mode.

5.The algorithm.
(If you are not interested in technical stuff, you can skip, 
or just run through this section)
In the first place: the algorithm of LifeCode is open and public. 
Real encryption software don't use 'secret algorithms'. If a hacker 
really wants to break a code, he should be able to find out the algorithm 
from the .EXE file anyway. So the algorithm is the following:
When you enter the password, it is usually about 2-10 characters.
It can be anything, but most probably it will be letters or numbers. This 
reduces security, as it reduces the number of passwords needed to be tried 
out in case of a 'brute force' attack.
But the program doesn't encrypt with this password.
It transforms it into a set of 128 bytes. This is the 'Initializing key' 
session. This transformation is done with a pseudo-random generator, with 
your password as seed for number generating.
This transformation is one-way transformation, meaning, that the 128 bytes key 
cannot be transformed back into the password in any ways.
Then follows the session which gave the name of the program.('Generating key')
The 128 bytes are put into a table of 32x32 points. (you can see this 
process if in graphics mode) Then the program uses a variant of the 
Conway-cellular automaton to transform the key even more.
It runs 128 steps of this cellular automaton. I will not relate this 
automaton here, you can find plenty of documentation on the internet or 
anywhere else.
Let's just say now, that this process uses very simple rules:
-a point is a cell.
-if a cell is alive, it will stay alive if it has 2,4,5 or 6 living neighbors
-if a cell isn't alive, it will reborn if it has 1,3,7 or 8 living neighbors.
You may ask why exactly theese numbers.
Because with these rules, the number of total living cells is relatively 
constant, and after 128 generations you get a key, which cannot possibly be 
transformed back into the original password, or even to the 128 bytes original
key. (It is almost impossible to reverse even one generation, and even in
reversing one generation, there are many-many possible predecessors)
This system is also unpredictable, noone can possibly find out your generating 
key, without running the whole process again (and knowing your original 
password).
When your key is ready, the program runs through the file to be encrypted 
byte to byte, using the following formula:
n[k]=(p[r1]+p[t[k-1] div 2]+t[k]+r2) mod 256.
where:
n[k] is the k-th byte of the encrypted message.
p[k] is the k-th byte of the 128 byte key obtained after running the 
cell-automation
r1, and r2 are pseudorandom bytes.
r(k) is a pseudorandom sequence, having a real random number as seed, 
which is stored in the file header.
t[k] is your original file.
Anyway, the file can not be decrypted without knowing the p key, which is 
impossible to know without knowing the original password. 
(after quiting p is not stored in the memory)
Using also a pseudorandom sequence with a real random number as seed makes 
that even if you encrypt the same file twice with the same password, you 
won't get the same encrypted file. (but of course, if you decrypt them 
with the same good password, you will get your original file back)
Decryption:
t[k]=(n[k]-p[r1]-r2-p[t[k-1] div 2]) mod 256.
In the beginning one has to read the random number from the file in order to 
initialize the random number generator correctly.

6.Technical.
The program was compressed with Fabrice Ballard's LzExe.
The encrypted file's header looks as follows:
first 3 bytes- identification
4. byte- random number
last 2 bytes- checksum.

7.Checksums.
The program calculates checksums of the original file and writes them in 
the encrypted file. If after decrypting, these don't match, it means that 
either you have entered a wrong password, or someone messed with the file.

8.Error messages.
The program has various error messages. In case of an error, it always quits 
completely.
ERROR:INVALID FILE NAME - you entered nothing for filename
ERROR:INVALID PASSWORD - you entered nothing for password
ERROR:INPUTFILE=OUTPUTFILE - you entered the same inputfile as outputfile
ERROR:PASSWORDS NOT MATCHING! - the password doesn't match with the 
re-entered one
ERROR:FILE NOT FOUND! - inputfile doesn't exist
ERROR:GRAPHICS ERROR:
ERROR:NOT A VALID LIFECODE FILE 
ERROR:CHECKSUM NOT MATCHING
these are obvious, I think

9.Tips on security.
-when you chose password, don't chose something anyone could guess (name, 
birthday,etc)
-make it as long and complicated as possible, combining small letters with 
capitals, BUT:
-make sure you will remember it
-if you protect a file on your hard drive, and want to delete the original 
file after encrypting, delete it with a low-level delete utility, so that 
it cannot be unerased (don't even think about just throwing to 
the 'Recycle Bin')
-if you use the program to encrypt a message and send it to someone, you 
will need to send him/her the password you used. Make sure you do this 
on a secure channel (preferably tell him/her in real life)
-change your password regularly
-thrust no-one:-)

-if you want to compress your files, do this before encrypting, encrpyted 
files can't be compressed too well, because they are just like random data.
-if you want to encrypt lots of files, compress them into one single archive 
(with ARJ, ZIP, RAR, or whatever) and then encrypt this single compressed file.

10.Contact me.
You should absolutely contact me.
Do this in the following cases:
-you want to ask me about LifeCode or my other programs
-you want to ask for the source code
-you want to register
-you want to share your opinion about the program with me
-any other cases

you can send messages, e-mails, money or letter-bombs to the following adress:

Kozma Laszlo
4150 Odorheiu Secuiesc
1918.dec.1.26.
Romania
e-mail:lkozma@mail.nextra.ro
or lkozma@k.ro

11.Registering.
You don't have to register, because LifeCode 1.00 is Freeware, BUT
if you find it useful, and you want to use it regularly, you should send me a 
note, or e-mail, or something, this will motivate me to continue doing it.
Also, any donations are welcomed, this will motivate me even more.
If you send, let's say, $5, you will receive the latest version of LifeCode,
with your name in it, and you will become a registered user.
The source code is also available for $10.
(this doesn't affect safety, as the algorithm is public anyway)
You are encouraged to freely distribute this package,
without modifying the contents of the files, and without charging
any price for it.

12.Legal stuff. 
The author (me) cannot be held responsible for any damages caused
by the usage of the program (though everything went well during
the testing).

that's all folks.
---
Kozma Laszlo <lkozma@mail.nextra.ro>