unit Unit1;interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;type
Tfrm_pwd = class(TForm)
Panel1: TPanel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
frm_pwd: Tfrm_pwd;
const
StartKey = 1976; {Start default key}
MultKey = 1977; {Mult default key}
AddKey = 1978; {Add default key} function Encrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;
function Decrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;
implementation{$R *.DFM}
function Encrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string; //加密
var
I : Byte;
begin
Result := '';
for I := 1 to Length(InString) do
begin
Result := Result + CHAR(Byte(InString[I]) xor (StartKey shr 8));
StartKey := (Byte(Result[I]) + StartKey) * MultKey + AddKey;
end;
end;
{*******************************************************
* Standard Decryption algorithm - Copied from Borland *
*******************************************************}
function Decrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string; //解密
var
I : Byte;
begin
Result := '';
for I := 1 to Length(InString) do
begin
Result := Result + CHAR(Byte(InString[I]) xor (StartKey shr 8));
StartKey := (Byte(InString[I]) + StartKey) * MultKey + AddKey;
end;
end;
procedure Tfrm_pwd.Button1Click(Sender: TObject);
begin
edit2.Text:=Decrypt(edit3.text,StartKey,MultKey,AddKey);
//edit2.Text:=encrypt(edit3.text,StartKey,MultKey,AddKey);
end;procedure Tfrm_pwd.Button2Click(Sender: TObject);
begin
edit3.text:=Encrypt(edit1.text,StartKey,MultKey,AddKey);
end;end.
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;type
Tfrm_pwd = class(TForm)
Panel1: TPanel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
frm_pwd: Tfrm_pwd;
const
StartKey = 1976; {Start default key}
MultKey = 1977; {Mult default key}
AddKey = 1978; {Add default key} function Encrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;
function Decrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;
implementation{$R *.DFM}
function Encrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string; //加密
var
I : Byte;
begin
Result := '';
for I := 1 to Length(InString) do
begin
Result := Result + CHAR(Byte(InString[I]) xor (StartKey shr 8));
StartKey := (Byte(Result[I]) + StartKey) * MultKey + AddKey;
end;
end;
{*******************************************************
* Standard Decryption algorithm - Copied from Borland *
*******************************************************}
function Decrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string; //解密
var
I : Byte;
begin
Result := '';
for I := 1 to Length(InString) do
begin
Result := Result + CHAR(Byte(InString[I]) xor (StartKey shr 8));
StartKey := (Byte(InString[I]) + StartKey) * MultKey + AddKey;
end;
end;
procedure Tfrm_pwd.Button1Click(Sender: TObject);
begin
edit2.Text:=Decrypt(edit3.text,StartKey,MultKey,AddKey);
//edit2.Text:=encrypt(edit3.text,StartKey,MultKey,AddKey);
end;procedure Tfrm_pwd.Button2Click(Sender: TObject);
begin
edit3.text:=Encrypt(edit1.text,StartKey,MultKey,AddKey);
end;end.
可以自己设计一个极其复杂的算法
绕他个百十来圈
再xor百十遍