request:encryption code into VB

avil

New member
Joined
Mar 27, 2008
Messages
1
Programming Experience
Beginner
Is anyone willing to help me translate this 'encryption' code from C into VB?
thanks a lot!!

Sonja

const
c1 = 52845;
c2 = 22719;

function Encrypt (const s: string; Key: Word) : string;
var
i : byte;
ResultStr : string;
begin
Result:=s;
{Result[0] := s[0]; }
for i := 0 to (length (s)) do
begin
Result := Char (byte (s) xor (Key shr 8));
Key := (byte (Result) + Key) * c1 + c2
end
end;

function Decrypt (const s: string; Key: Word) : string;
var
i : byte;
begin
{Result[0] := s[0];}
Result:=s;
for i := 0 to (length (s)) do
begin
Result := Char (byte (s) xor (Key shr 8));
Key := (byte (s) + Key) * c1 + c2
end
end;
 
Back
Top