Código en delphi...
He encontrado esto en una web. ¿Alguien me puede explicar paso a paso qué hace?
const
{C1 y C2 are used for encryption of Master Password string}
{C1 y C2 aon usadas para encriptar la cadena de la clave}
C1 = 52845;
C2 = 11719;
{ Standard Decryption algorithm - Copied from Borland}
function Decrypt(const S: String; Key: Word): String;
var
I: byte;
begin
SetLength(Result,Length(S));
for I := 1 to Length(S) do begin
Result := char(byte(S) xor (Key shr 8));
Key := (byte(S) + Key) * C1 + C2;
end;
end;
{ Standard Encryption algorithm - Copied from Borland}
function Encrypt(const S: String; Key: Word): String;
Var
I: byte;
begin
SetLength(Result,Length(S));
for I := 1 to Length(S) do begin
Result := char(byte(S) xor (Key shr 8));
Key := (byte(Result) + Key) * C1 + C2;
end;
end;
const
{C1 y C2 are used for encryption of Master Password string}
{C1 y C2 aon usadas para encriptar la cadena de la clave}
C1 = 52845;
C2 = 11719;
{ Standard Decryption algorithm - Copied from Borland}
function Decrypt(const S: String; Key: Word): String;
var
I: byte;
begin
SetLength(Result,Length(S));
for I := 1 to Length(S) do begin
Result := char(byte(S) xor (Key shr 8));
Key := (byte(S) + Key) * C1 + C2;
end;
end;
{ Standard Encryption algorithm - Copied from Borland}
function Encrypt(const S: String; Key: Word): String;
Var
I: byte;
begin
SetLength(Result,Length(S));
for I := 1 to Length(S) do begin
Result := char(byte(S) xor (Key shr 8));
Key := (byte(Result) + Key) * C1 + C2;
end;
end;
1 Respuesta
Respuesta de sherdal
1