Cifrado Basico [By Expermicid]

Iniciado por Expermicid, Julio 05, 2012, 11:11:41 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Julio 05, 2012, 11:11:41 PM Ultima modificación: Abril 21, 2013, 01:12:41 PM por Expermicid
Hola a todos.

Despues de haber consultado a algunos usuarios ( entre ellos Metal ) decidi introducirne en Delphi.

Como primer programa traduci el You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login que habia hecho en Vb6 a Delphi.

Cifrar:

Código: delphi
function Cifrar( text : string; num : Integer) : string;
  var
    i : Integer;
    aux : string;
  begin
    aux := '';
    for i := 1 to Length(text) do
      begin
        if ord(text[i]) mod 2 = 0 then
          if num mod 2 = 0 then
            aux := aux + chr(ord(text[i]) + num)
          else
            aux := aux + chr(ord(text[i]) - num)
        else
          if num mod 2 = 0 then
            aux := aux + chr(ord(text[i]) - num)
          else
            aux := aux + chr(ord(text[i]) + num)
      end;
      Result := aux;
  end;


Decifrar:

Código: delphi
function Descifrar(text : string; num : Integer) : string;
  var
    i : Integer;
    aux : string;
  begin
    aux := '';
    for i := 1 to Length(text) do
      begin
        if ord(text[i]) mod 2 = 0 then
          aux := aux + chr(ord(text[i]) - num)
        else
          aux := aux + chr(ord(text[i]) + num)
      end;
      Result := aux;
  end;




Saludos

Buenisimo, asique te desidiste pasar a delpho.. Buena eleccion!
Saludos,, Cronos.-

Hola amigo, como posso usar este codigo?

Memo1.Lines.Text := Encryptar(Memo2.Lines.Text);   isto?

Saludos!

You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
Hola amigo, como posso usar este codigo?

Memo1.Lines.Text := Encryptar(Memo2.Lines.Text);   isto?

Saludos!
Si no sabes Delphi no lo intentes, rippear todos sabemos.
Twitter: @The_Pr0ph3t
[email protected]