?? unit1.pas
字號:
unit Unit1;
interface
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
StdCtrls,
Buttons,
IdHashMessageDigest,
IdGlobal,
IdHash,
IdBaseComponent,
IdComponent,
Clipbrd;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
GroupBox1: TGroupBox;
BitBtn1: TBitBtn;
Edit2: TEdit;
Label2: TLabel;
Edit3: TEdit;
Label3: TLabel;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Function Gethashstr(pwd: String): String;
var
hash:T4x4LongWordRecord;
hashstr,S1:String;
i:integer;
begin
SetLength(hashstr,16);
with TIdHashMessageDigest5.Create do begin
hash:=HashValue(pwd);
Move(hash,hashstr[1],16);
for i := 1 to Length(hashstr) do
S1 := S1 + Format('%02x', [Byte(hashstr[i])]);
while Pos('', S1) > 0 do S1[Pos('', S1)] := '0';
hashstr:=S1;
result:=hashstr;
Free;
end;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
Var
MYMD5:TIdhashMessageDigest5;
Digest:T4x4LongWordRecord;
begin
MyMD5 := TIdHashMessageDigest5.Create;
Digest := MyMD5.HashValue(Edit1.Text);//請輸入明文
Edit3.Text:=(MyMD5.AsHex(Digest)); //顯示32個字符長度的MD5簽名結果
Edit2.Text:=(Copy(MyMD5.AsHex(Digest), 9, 16)); //顯示16個字符長度的MD5簽名結果
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
Clipboard.SetTextBuf(Pchar(Edit3.Text));
Application.MessageBox('MD5內容已經被復制到剪貼板','提示',MB_ICONINFORMATION);
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -