Pomoc oko algoritma za enkripciju

mils:
Ako neko ima bilo kakav kod za enkripciju sa komentarima u javi , C-u ili sl. za recimo MD2, MD5, SHA, hash, DES , AES ili nesto slicno samo da nije Cezarov ;)


Evo ti nesto iz Delphija mozda ti pomogne


function Encrypt(const S: String; Key: Word): String;
const
c1=52845;
c2=22719;
var
I: byte;
r: array [1..50] of char;
m:string;
begin
for I := 1 to Length(S) do begin
R := char(byte(S) xor (Key shr 8));
Key := (byte(R) + Key) * C1 + C2;
m:=m+r;
end;
result:=m;
for i:=1 to length(s) do begin
r:=#0;
m:='';
end;
end;

function Decrypt(const S: String; Key: Word): String;
const
c1=52845;
c2=22719;
var
I: byte;
r: array [1..50] of char;
m:string;
begin
for I := 1 to Length(S) do begin
R := char(byte(S) xor (Key shr 8));
Key := (byte(S) + Key) * C1 + C2;
m:=m+r
end;
result:=m;
for i:=1 to length(s) do begin
r:=#0;
m:='';
end;
end;
 

Back
Top