uses Math
function encriptar(dato:string):string;
function desencriptar(dato:string):string;
//*********************************************
function TclientesN.encriptar(dato:string):string;
var
myNum : Byte;
i: integer;
tam: integer;
aux:string;
begin
tam:=Length(dato);
for i:=1 to Length(dato) do
begin
myNum := Ord(dato[i]);
myNum:=myNum + 1;
dato[i]:=Chr(myNum);
aux:=aux+Chr(myNum)+ Chr(RandomRange(65,90))+ Chr(RandomRange(97,122));
end;
result:=aux;
end;
//*********************************************
function TclientesN.desencriptar(dato:string):string;
var
myNum : Byte;
i,j: integer;
tam: integer;
aux:string;
begin
tam:=(Length(dato) div 3);
j:=0;
for i:=1 to Length(dato) do
begin
j:=j+1;
if j=1 then
begin
myNum := Ord(dato[i]);
myNum:=myNum - 1;
dato[i]:=Chr(myNum);
aux:=aux+Chr(myNum);
end;
if j=3 then
begin
j:=0;
end;
end;
result:=aux;
end;
martes, 17 de julio de 2018
Suscribirse a:
Entradas (Atom)