Brad Clarke wrote in a message to All:
BC> {Convert key string to array}
BC> For i := 1 To Length(KeyValue) do
BC> begin
BC> sTemp := Copy(KeyValue, i, 1);
BC> KeyChar[i] := Ord(sTemp);
BC> end;
This example is very similar to what you are trying to do. it works well
here.
function Encrypted( Decryptedstr : string ):string;
var loop :byte;
tempstr : string;
tempint : integer;
begin
fillchar( tempstr, sizeof( tempstr ), #0 );
for loop := 1 to length( decryptedstr ) do
begin
tempint := ord( Decryptedstr[ loop ] );
tempint := tempint - 14; // Not a very sophisticated scheme, but
// should suffice as an example.
tempstr := tempstr + chr( tempint );
end;
Encrypted := tempstr;
end;
function decrypted( Encryptedstr : string ):string;
var loop :byte;
tempstr : string;
tempint : integer;
begin
fillchar( tempstr, sizeof( tempstr ), #0 );
for loop := 1 to length( Encryptedstr ) do
begin
tempint := ord( Encryptedstr[ loop ] );
tempint := tempint + 14;
tempstr := tempstr + chr( tempint );
end;
decrypted := trimright( tempstr ); // You might not need to trim the
string,
// but it doesn't hurt.
end;
Thanks,
Ryan
---
---------------
* Origin: Midnight Express, Fairlawn Ohio (1:157/110)
|