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