Tema: Encriptar
Ver Mensaje Individual
  #3  
Antiguo 06-08-2013
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Reputación: 23
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
LUCHO,

Cita:
Empezado por LUCHO
...Quisiera saber como encriptar palabras...
Revisa este código
Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    Label3: TLabel;
    Edit3: TEdit;
    Label4: TLabel;
    Edit4: TEdit;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// Encripta y Desencripta un String con una Clave por medio de Funciones Lógicas
function EnDeCrypt(const Value, Key : String) : String;
var
   i : Integer;
   KeyAlt : Integer;

begin

   KeyAlt := Length(Key);

   for i := 1 to Length(Key) do
      KeyAlt := KeyAlt xor Ord(Key[i]);

   Result := Value;
   for i := 1 to Length(Value) do
   begin
      Result[i] := chr(not(ord(Value[i]) xor Ord(KeyAlt)));
   end

end;

// Encripta un String con una Clave
procedure TForm1.Button1Click(Sender: TObject);
var
   Data : String;
   Key : String;

begin
   Data := Edit1.Text;
   Key := Edit2.Text;
   Edit3.Text := EnDeCrypt(Data,Key);
end;

// Desencripta un String con una Clave
procedure TForm1.Button2Click(Sender: TObject);
var
   DataEnc : String;
   Key : String;

begin
   DataEnc := Edit3.Text;
   Key := Edit2.Text;
   Edit4.Text := EnDeCrypt(DataEnc,Key);
end;

end.
El código anterior en un ejemplo básico de Encriptación y Desencriptación de un String con una Clave por medio de las funciones lógicas Not y Xor.

El ejemplo anterior esta disponible en el link : http://terawiki.clubdelphi.com/Delph...=EnDeCrypt.rar

Te sugiero revisar estos links:
Cita:
The CrypTool Portal : http://www.cryptool.org/en/

Cifrar texto con AES-256 : http://delphi.jmrds.com/?q=node/44

Delphi Encryption Compendium (DEC) : http://code.google.com/p/delphidec/
Espero sea útil

Nelson.

Última edición por nlsgarcia fecha: 06-08-2013 a las 07:09:40.
Responder Con Cita