home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2003 February
/
Chip_2003-02_cd1.bin
/
ctenari
/
Hytha
/
HCrypt.exe
/
SR_KOP.RAR
/
SRC
/
Unit2.pas
< prev
Wrap
Pascal/Delphi Source File
|
2002-10-31
|
2KB
|
84 lines
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DCPcrypt2, DCPsha1, jpeg, ExtCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
DCP_sha11: TDCP_sha1;
Image1: TImage;
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const RNDL=1024;
var
Form2: TForm2;
RBuf2:Array[0..RNDL+1]of Byte;
RPL:LongInt;
LastX,LastY:Integer;
implementation
{$R *.dfm}
procedure TForm2.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
function HSH(Co:String):Byte;
var Pom:Byte;
H:Array[0..1024] of Byte;
I:Word;
begin
Pom:=0;
with Form2.DCP_sha11 do begin
Init;
Update(Co[1],Length(Co));
Final(H);
for I:=0 to ((HashSize div 8)-1) do
Pom:=Pom Xor H[I];
end;
HSH:=Pom;
end;
function PL(Co:String):String;
var Pom:String;
begin
Pom:=Co;
while Length(Pom)<3 do Pom:='0'+Pom;
PL:=Pom;
end;
begin
Label2.Caption:=PL(IntToStr((100*RPL) div RNDL));
//// RND
RBuf2[RPL]:=(X+Y) xor (X*Y) xor (X-Y) xor Random($FF) xor (LastX-X) xor (LastY-Y) xor HSH(DateTimeToStr(Now));
//// RND
RPL:=RPL+1;if RPL>RNDL then RPL:=RNDL;
LastX:=X;
LastY:=Y;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
Randomize;
LastX:=Random(65536);
LastY:=Random(65536);
end;
end.