-
Notifications
You must be signed in to change notification settings - Fork 3
/
DEKHash.pas
49 lines (36 loc) · 861 Bytes
/
DEKHash.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
unit DEKHash;
//DEK Hash
interface
uses SysUtils, HasherBase;
type THasherDEKHash = class(THasherbase)
private
FHash: Cardinal;
public
constructor Create; override;
procedure Update(Msg: PByte; Length: Integer); override;
function Final: String; override;
end;
implementation
constructor THasherDEKHash.Create;
begin
inherited Create;
Check := 'AB4ACBA5';
FHash := 0;
end;
procedure THasherDEKHash.Update(Msg: PByte; Length: Integer);
var i: Integer;
Val: Cardinal;
begin
FHash := Length;
for i:=0 to Length-1 do begin
FHash := ((FHash shl 5) xor (FHash shr 27)) xor Msg^;
Inc(Msg);
end;
end;
function THasherDEKHash.Final: String;
begin
Result := IntToHex(FHash, 8);
end;
initialization
HasherList.RegisterHasher('DEK Hash', THasherDEKHash);
end.