Ver Mensaje Individual
  #7  
Antiguo 28-03-2007
Avatar de ArdiIIa
[ArdiIIa] ArdiIIa is offline
Miembro Premium
 
Registrado: nov 2003
Ubicación: Valencia city
Posts: 1.481
Reputación: 22
ArdiIIa Va por buen camino
Algo sencillo:


Código Delphi [-]

function Encrypt(const S: String; Key: Word): String;
var
  I: integer;
begin
  SetLength(Result, length(S));
  for I := 1 to Length(S) do
    begin
     Result[i] := char(byte(S[i]) xor (Key shr 8));
     Key := (byte(Result[i]) + Key) * EncryptC1 + EncryptC2;
    end;
end;


function Decrypt(const S: String; Key: Word): String;
var
  I: integer;
begin
  SetLength(Result, length(S));
  for I := 1 to Length(S) do
    begin
      Result[i] := char(byte(S[i]) xor (Key shr 8));
      Key := (byte(S[i]) + Key) * EncryptC1 + EncryptC2;
    end;
end;


EncryptC1 y EncryptC2 son dos constantes a elección de cada uno... Y porsupuesto Key, también a elección de cada uno.
__________________
Un poco de tu generosidad puede salvar la vida a un niño. ASÍ DE SENCILLO
Responder Con Cita