J
jgame
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, DB, ADODB, fcdbtreeview, dxtree, dxdbtree,
ImgList, Mask, DBCtrls, Menus, strutils;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function Encrypt(Src: String
Key: string):String;
var
KeyLen :Integer;
KeyPos :Integer;
offset :Integer;
dest :string;
SrcPos :Integer;
SrcAsc :Integer;
Range :Integer;
begin
KeyLen:=Length(Key);
if KeyLen = 0 then
key:='Think Space';
KeyPos:=0;
Range:=256;
Randomize;
offset:=Random(Range);
dest:=format('%1.2x',[offset]);
for SrcPos := 1 to Length(Src) do
begin
SrcAsc:=(Ord(Src[SrcPos]) + offset) MOD 255;
if KeyPos < KeyLen then
KeyPos:= KeyPos + 1 else KeyPos:=1;
SrcAsc:= SrcAsc xor Ord(Key[KeyPos]);
dest:=dest + format('%1.2x',[SrcAsc]);
offset:=SrcAsc;
end;
Result:=Dest;
end;
//////////////////////////////////////
procedure TForm1.Button1Click(Sender: TObject);
var s:string;
begin
s:='111111';
showmessage(Encrypt(s,'12635'));
end;
end.
{
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, DB, ADODB, fcdbtreeview, dxtree, dxdbtree,
ImgList, Mask, DBCtrls, Menus, strutils;
引用上面这些单元后,
加数函数,
Encrypt(s,'12635');
就变随机数了..
点一下变一个.
这是怎么回事???
请高手指教一下.
}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, DB, ADODB, fcdbtreeview, dxtree, dxdbtree,
ImgList, Mask, DBCtrls, Menus, strutils;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function Encrypt(Src: String
Key: string):String;
var
KeyLen :Integer;
KeyPos :Integer;
offset :Integer;
dest :string;
SrcPos :Integer;
SrcAsc :Integer;
Range :Integer;
begin
KeyLen:=Length(Key);
if KeyLen = 0 then
key:='Think Space';
KeyPos:=0;
Range:=256;
Randomize;
offset:=Random(Range);
dest:=format('%1.2x',[offset]);
for SrcPos := 1 to Length(Src) do
begin
SrcAsc:=(Ord(Src[SrcPos]) + offset) MOD 255;
if KeyPos < KeyLen then
KeyPos:= KeyPos + 1 else KeyPos:=1;
SrcAsc:= SrcAsc xor Ord(Key[KeyPos]);
dest:=dest + format('%1.2x',[SrcAsc]);
offset:=SrcAsc;
end;
Result:=Dest;
end;
//////////////////////////////////////
procedure TForm1.Button1Click(Sender: TObject);
var s:string;
begin
s:='111111';
showmessage(Encrypt(s,'12635'));
end;
end.
{
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, DB, ADODB, fcdbtreeview, dxtree, dxdbtree,
ImgList, Mask, DBCtrls, Menus, strutils;
引用上面这些单元后,
加数函数,
Encrypt(s,'12635');
就变随机数了..
点一下变一个.
这是怎么回事???
请高手指教一下.
}