-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGHash3.pas
48 lines (37 loc) · 853 Bytes
/
GHash3.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
unit GHash3;
//GHash3
//Author: domasz
//Last Update: 2022-11-20
//Licence: MIT
interface
uses SysUtils, HasherBase;
type THasherGHash3 = class(THasherbase)
private
FHash: Cardinal;
public
constructor Create; override;
procedure Update(Msg: PByte; Length: Integer); override;
function Final: String; override;
end;
implementation
constructor THasherGHash3.Create;
begin
inherited Create;
Check := '8DCCB81D';
FHash := 0;
end;
procedure THasherGHash3.Update(Msg: PByte; Length: Integer);
var i: Integer;
begin
for i:=0 to Length-1 do begin
FHash := (FHash shl 3) + FHash + Msg^;
Inc(Msg);
end;
end;
function THasherGHash3.Final: String;
begin
Result := IntToHex(FHash, 8);
end;
initialization
HasherList.RegisterHasher('GHash3', THasherGHash3);
end.