added CRC32 function

This commit is contained in:
Razor12911 2022-05-22 23:23:15 +02:00
parent b7ed0e45b2
commit 4797195ad3
1 changed files with 7 additions and 1 deletions

View File

@ -7,7 +7,7 @@ uses
WinAPI.Windows, WinAPI.PsAPI,
System.SysUtils, System.Classes, System.SyncObjs, System.Math, System.Types,
System.AnsiStrings, System.StrUtils, System.IniFiles, System.IOUtils,
System.RTLConsts, System.TypInfo, System.Net.HttpClientComponent,
System.RTLConsts, System.TypInfo, System.ZLib, System.Net.HttpClientComponent,
System.Generics.Defaults, System.Generics.Collections;
procedure ShowMessage(Msg: string; Caption: string = '');
@ -355,6 +355,7 @@ type
PExecOutput = ^TExecOutput;
TExecOutput = reference to procedure(const Buffer: Pointer; Size: Integer);
function CRC32(CRC: longword; buf: PByte; len: cardinal): longword;
function Hash32(CRC: longword; buf: PByte; len: cardinal): longword;
procedure XORBuffer(InBuff: PByte; InSize: Integer; KeyBuff: PByte;
@ -2082,6 +2083,11 @@ begin
AddByte((PByte(AData) + I)^);
end;
function CRC32(CRC: longword; buf: PByte; len: cardinal): longword;
begin
Result := System.ZLib.CRC32(CRC, buf, len);
end;
function Hash32(CRC: longword; buf: PByte; len: cardinal): longword;
begin
Result := crc32c(CRC, PAnsiChar(buf), len);