I am using that function on Delphi XE2 to hash a string.
I have a bad result if the program is run on Windows 10 — the result is null
because TidHashSHA512.isavailable
is FALSE
.
What do I have to do?
function HashSHA512String(Text: String): String;
var
IdHashSHA512: TIdHashSHA512;
begin
Result := '';
if HashFunctionsOpenSSLLoaded then begin
if TIdHashSHA512.IsAvailable then begin // <-- ADD THIS
IdHashSHA512 := TIdHashSHA512.Create;
try
Result := IdHashSHA512.HashStringAsHex(Text);
finally
FreeAndNil(IdHashSHA512);
end;
end;
end;
end;