-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsum_sysv.pas
51 lines (40 loc) · 978 Bytes
/
sum_sysv.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
49
50
51
unit SUM_SYSV;
//SUM SYSV
//Author: domasz
//Version: 0.1 (2022-11-17)
//Licence: MIT
interface
uses SysUtils, HasherBase;
type THasherSUM_SYSV = class(THasherbase)
private
FHash: Cardinal;
public
constructor Create; override;
procedure Update(Msg: PByte; Length: Integer); override;
function Final: String; override;
end;
implementation
constructor THasherSUM_SYSV.Create;
begin
inherited Create;
Check := '01DD';
FHash := 0;
end;
procedure THasherSUM_SYSV.Update(Msg: PByte; Length: Integer);
var i: Integer;
begin
for i:=0 to Length-1 do begin
FHash := FHash + Msg^;
Inc(Msg);
end;
end;
function THasherSUM_SYSV.Final: String;
var Val: Cardinal;
begin
Val := FHash mod 65536 + (FHash mod 4294967296) div 65536;
FHash := (Val mod 65536) + Val div 65536;
Result := IntToHex(FHash, 4);
end;
initialization
HasherList.RegisterHasher('SUM SYSV', THasherSUM_SYSV);
end.