Coder's Guild Mailing List

Algorythm in encryption

Posted by Fe 2+ on 1998-03-01

There's many algorithm in encryption my friend "Mr Heydon" give a solution
with Crypt Mask and mix it with XOR
another give to change ascii code

there's 2 Code didn't perfect
from Mr Heydon it's contains to many extended character so we can't decrypt
it like it contain a carriage return code and so many
the other one is too easy to crack it

I will attach Mr Heydon solution , I hope there's anybody out there tell me
more ....... I don't attach the second solution cause its too easy......
Well that's all

Thanx

Love Peace Emphaty
Fe2+

----------
> From: Fe 2+ <JAVA@xxx-xxxxxxxx.xxx>
> To: Mike Heydon <pgbison@xxxxxxx.xxx>
> Subject: Encrypt algorithm
> Date: Wednesday, February 25, 1998 05:37

> Hi Mr Heydon
> This Question I asked for many senior in my University and =
Newsgroup
> but I got no answer.....or the answer is
> "Trying to change the asscii code like 'a'=3D#97 then add 3 to 'a' so =
all
the
> character add 3. so 'aba' will be 'ded' " I think=20
> It's not a good solution.

There are many books and articles on encryption available. Depending on =
the
level of security they get progressively more complex. A very simple way =
of
encrypting is tho use the XOR function mask with a repeating key. This
gives a reasonable level of security that could take a long time to =
break.
The algorythm goes something like this ......


const CryptMask =3D 'The Stars are Very Bright Tonight'; // Can =
be
any length or content

var CryptLen,i,j,k : integer;
InString,Crypted,Encrypted : string;

begin
CryptLen :=3D Length(CryptMask);
Readln('Enter Text String ',InString); // Capture string or =
even
read from file

i :=3D Length(InString);
j :=3D 1;
Crypted :=3D '';

for k :=3D 1 to i do
begin
Crypted :=3D Crypted + char(byte(InString[k]) XOR =
byte(CryptMask[j]));
inc(j);
if j > Length(CryptLen) then j :=3D 1;
end;
=20
Writeln('Crypted string is ',Crypted); // String is encrypted -
Notice a lot of chars are actually non printable or extended
// =
characters.
=20

// to de-encrypt simply use the the mask on the crypted string

i :=3D Length(Crypted);
j :=3D 1;
Encrypted :=3D '';

for k :=3D 1 to i do
begin
Encrypted :=3D Encrypted + char(byte(Crypted[k]) XOR
byte(CryptMask[j]));
inc(j);
if j > Length(CryptLen) then j :=3D 1;
end;

Writeln('Encrypted string is ',Encrypted); // String is back to =
its
origional form
end;

Obviously the longer you make the encryption mask the more difficult it
will be to crack as occuring sets of characters will be harder to spot. =
The
advantage of using the mask string is that a letter will not always be
encypted as the same code.

Good luck
Mike Heydon



=20

// =
characters.
=20