I wanted to create an application which will open a specified txt file and encrypt the

content and save it. How do i do that??. Is there any tutorial or a program that i can

download.I am a newbie to encryption and dont know even the a,b,c... of it so where do

i start from??
Posted on 2003-04-29 02:41:02 by telophase
Do you know how to copy a file? ;-)

anyway, it's easy. Pseudocode:

set up key
write header
for each block in file, do:
{
read block
encrypt block
write block
}
if there's any remaining bytes (file size wasn't a multiple of block size), do:
{
read remaining bytes
pad to block size
encrypt block
write block
}
Posted on 2003-04-29 02:55:21 by f0dder
The simplest thing is just xor-ing the bytes

an example in delphi/pascal syntax:


Procedure EncodeString(var s : String; key : Byte);
Var
i : Integer;
Begin
For i:=1 to length(s) do
s[i] := chr( ord(s[i]) xor key );
End;


you can use the same procedure for decoding, if you know the
key used to encode, the range for the key is 0..255 so it's not so hard
to crack ;)

have fun
Posted on 2003-04-29 04:04:16 by Azrim
You can get encryption libarays for djgpp compillre that will nake the job easer
Posted on 2003-04-29 11:53:04 by rob.rice
XOR encryption is not secure at all specially if you know what you are searching for.

for examping , if it is plain english , the person will keep trying till he get the text.

attached a program i code ago to do this. ( sorry for bad coding , it was acm contest, but it just show you the concept )

you may better search the net for any algorism better than XOR.
Posted on 2003-05-01 04:48:39 by Sa6ry
No need to go into "XOR is insecure" etc in this thread. The guy needs _any_ encryption, just to get something going... having an encryption algorithm doesn't help any if you don't know how to use it.
Posted on 2003-05-01 05:05:25 by f0dder