![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
unit
Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs , IdHashMessageDigest, StdCtrls;
type
TMD5 = class (TIdHashMessageDigest5);
TForm2 = class (TForm)
Memo1: TMemo;
Button1: TButton;
Memo2: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end ;
var
Form2: TForm2;
implementation
{ $R *.dfm }
procedure TForm2.Button1Click(Sender: TObject);
var
MyMD5: TMD5;
begin
MyMD5 : = TMD5.Create;
try
Memo2.Text : = MyMD5.HashStringAsHex(Memo1.Text); // Indy10中可以直接HashStringAsHex
finally
MyMD5.Free;
end ;
end ;
end .
以上方法只适合 Indy10
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs , IdHashMessageDigest, StdCtrls;
type
TMD5 = class (TIdHashMessageDigest5);
TForm2 = class (TForm)
Memo1: TMemo;
Button1: TButton;
Memo2: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end ;
var
Form2: TForm2;
implementation
{ $R *.dfm }
procedure TForm2.Button1Click(Sender: TObject);
var
MyMD5: TMD5;
begin
MyMD5 : = TMD5.Create;
try
Memo2.Text : = MyMD5.HashStringAsHex(Memo1.Text); // Indy10中可以直接HashStringAsHex
finally
MyMD5.Free;
end ;
end ;
end .
以上方法只适合 Indy10