用户登录  |  用户注册
首 页商业源码原创产品编程论坛
当前位置:PB创新网文章中心编程技巧Delphi

AccesS密码的打击

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2009-03-16 20:20:39

type
  TForm1 = class(TForm)
    Button1: TButton;
    Chk2000: TCheckBox;
    Edit1: TEdit;
    Button2: TButton;
    Edit2: TEdit;
    OpenDialog1: TOpenDialog;
    Button3: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Edit2KeyPress(Sender: TObject; var Key: Char);
  private
  procedure WMDropFiles(var Msssage: TMessage); message WM_DROPFILES ;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

CONST
  xorString:array[0..12]of byte=
    ( $86, $FB, $EC, $37,
      $5D, $44, $9C, $FA,
      $C6, $5E, $28, $E6,$13 );
  xorString2:array[0..20]of byte=
    ( $D3, $EC, $08, $9C,
      $93, $28, $46, $8A,
      $01, $7B, $A0, $DF,
      $22, $13, $9A, $B1,
      $61, $79, $C7, $7C,$5B);

procedure TForm1.WMDropFiles(var Msssage: TMessage);
begin
  ShowMessage(Hello Boy);
end;
procedure TForm1.Button1Click(Sender: TObject);


VAR
passBuff: array[0..14]of byte;
pass: array[0..14]of char;
passBuff2: array[0..40]of byte;
pass2: array[0..20]of char;
B: Byte;
F:TFileStream;
I,j:integer;

begin
  file://ShowMessage(Char($86)+ Char($F8)+Char($EC))
  if not FileExists(Edit1.Text) then
   begin
     MessageBox(Handle,你是MM呀,我好种意你呀,MB_OK + MB_ICONINFORMATION);
     exit;
   END;
  F :=  TFileStream.Create(Edit1.text,fmOpenRead);
  if not Chk2000.Checked then
  begin
    Try
      F.Seek($42,soFromBeginning);
      F.Read(PassBuff,14);
      for i := 0 to 13 do
      begin
        B := PassBuff[i] XOR xorString[i];
        Pass[i] := Char(B);
      end;
      pass[Sizeof(Pass)-1] := #0;
      Edit2.Text := StrPas(Pass);
      finally
    f.Free;
    end;
  end
  else
  begin
     try
     F.Seek($42,soFromBeginning);
     F.Read(passBuff2,40);
     I:=0;j:=0;
     while I<40 do
     begin
        B := passBuff2[i] xor xorString2[j];
        pass2[j]:=char(B);
        inc(i,2);inc(j);
     end;
    pass2[sizeof(pass2) - 1] := #0;
    Edit2.Text:=StrPas(Pass2);
   finally
    f.Free;
   end;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
    Edit1.text := OpenDialog1.FileName;
end;


procedure TForm1.Button3Click(Sender: TObject);
VAR
passBuff: array[0..14]of byte;
pass: array[0..14]of char;
passBuff2: array[0..40]of byte;
pass2: array[0..20]of char;
B: Byte;
F:TFileStream;
I,j:integer;
s: string;
begin
  file://ShowMessage(Char($86)+ Char($F8)+Char($EC))
  if not FileExists(Edit1.Text) then
   begin
     MessageBox(Handle,你是MM呀,我好种意你呀,MB_OK + MB_ICONINFORMATION);
     exit;
   END;
  F :=  TFileStream.Create(Edit1.text,fmOpenWrite);
  if not Chk2000.Checked then
  begin
    Try
      FillChar(Pass,14,#0);
      s := EdIt2.Text;
      StrCopy(@Pass,Pchar(Trim(s)));
      for i := 0 to 13 do
      begin
        B := Byte(Pass[i]);
        PassBuff[i] := xorString[i] xor B;
      end;
      PassBuff[13] := $B6;
      F.Seek($42,soFromBeginning);
      F.Write(PassBuff,14);
      finally
    f.Free;
    end;
  end
  else
  begin
     try
     F.Seek($42,soFromBeginning);
     F.Read(passBuff2,40);
     I:=0;j:=0;
     while I<40 do
     begin
        B := passBuff2[i] xor xorString2[j];
        pass2[j]:=char(B);
        inc(i,2);inc(j);
     end;
    pass2[sizeof(pass2) - 1] := #0;
    Edit2.Text:=StrPas(Pass2);
   finally
    f.Free;
   end;
  end;


end;

procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
  file://if length(Edit1.text) >= 13 then Key := #0;
end;

end.


Tags:

作者:佚名

文章评论评论内容只代表网友观点,与本站立场无关!

   评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论
PB创新网ourmis.com】Copyright © 2000-2009 . All Rights Reserved .
页面执行时间:12,328.13000 毫秒
Email:ourmis@126.com QQ:2322888 蜀ICP备05006790号