Delphi Hash算法[3] CRC
{该文首发于博客园 滔Roy,无须授权即可转发,请自觉保留头部申明}
引用单元:IdHashCRC
1、字符:
var CRC:TIdHashCRC32; begin CRC:=TIdHashCRC32.Create; Memo2.Text:=IntToStr(CRC.HashValue(Memo1.Text)); CRC.Free; end;
2、文件:
var MemSteam: TMemoryStream; CRC:TIdHashCRC32; begin try CRC:=TIdHashCRC32.Create; MemSteam:=TMemoryStream.Create; if OpenDialog1.Execute then begin MemSteam.LoadFromFile(OpenDialog1.FileName); Memo2.Text:=IntToStr(CRC.HashValue(MemSteam)); end; finally MemSteam.Free; CRC.Free; end; end;
创建时间:2021.04.29 更新时间: