delphi中MD5的获取(Indy 10)

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
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步