密文算法推薦。因愛好在嘗試對數庫進行加密,密碼算法難求?進來看看衆位看官!!!

Nizvoo 2001-10-14 12:37:54
密文算法推薦。因愛好在嘗試對數庫進行加密,密碼算法難求?進來看看衆位看官!!!

請將算法思想或是鏈接地址貼在這裏,不勝感激!!!
...全文
171 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
yxjjx 2001-10-15
  • 打赏
  • 举报
回复
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.
Nizvoo 2001-10-15
  • 打赏
  • 举报
回复
快来呀
Nizvoo 2001-10-14
  • 打赏
  • 举报
回复
本人自己UP
Nizvoo 2001-10-14
  • 打赏
  • 举报
回复
又下了。

5,927

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧