I'm trying to use the SHA3 cryptography library that is in the repository https://github.com/TheLazyTomcat/lib.SHA3 in Delphi 7, however, I wasn't successful. The project compiles using the library but I don't know how to implement it. I would like to generate a SHA3-512 hash from a string using this library but I don't know how to do it. Can someone help me?
I started the code below but I couldn't evolve to the solution:
procedure TForm1.Button1Click(Sender: TObject);
var
Hasher: TSHA3_512Hash;
Hash: TSHA3_512;
Input: string;
I: Integer;
begin
Input := 'Hello, world!';
Hasher := TSHA3_512Hash.Create;
try
Hasher.Init;
Hasher.Update(Input[1], Length(Input) * SizeOf(Char));
Hasher.HashString(Input);
//Hash := Hasher.Final;
finally
Hasher.Free;
end;
{ShowMessage('Hash SHA-3 de ' + Input + ':'#13#10
+ '0x' + IntToHex(Hash[0], 2));
for I := 1 to 63 do
ShowMessage('0x' + IntToHex(Hash[I], 2));}
end;