class function TCloudSHA256Authentication.GetStreamToHashSHA256Hex(const Content: TStream): string;
class function TCloudSHA256Authentication.GetStreamToHashSHA256Hex(const Content: TStream): string;
var
LBytes : TBytes;
Hash: THashSHA2;
begin
LBytes := TBytesStream(Content).Bytes;
//Hash bytes
Hash := THashSHA2.Create;
Hash.Update(LBytes);
Result := Hash.HashAsString;
end;
I can't quite believe the cast on the first line...... How could this ever come to pass? Are there really no standards left at Embarcadero? Who writes this code? Who reviews it? Do they know what quality means?
And all that before we get onto the concept of requiring the entire stream to be in contiguous memory before contemplating hashing it. A WTF in itself, but paling in comparison to that travesty of a cast.
http://stackoverflow.com/questions/43476183/delphi-thashsha2-return-a-wrong-sha256-on-huge-file
var
LBytes : TBytes;
Hash: THashSHA2;
begin
LBytes := TBytesStream(Content).Bytes;
//Hash bytes
Hash := THashSHA2.Create;
Hash.Update(LBytes);
Result := Hash.HashAsString;
end;
I can't quite believe the cast on the first line...... How could this ever come to pass? Are there really no standards left at Embarcadero? Who writes this code? Who reviews it? Do they know what quality means?
And all that before we get onto the concept of requiring the entire stream to be in contiguous memory before contemplating hashing it. A WTF in itself, but paling in comparison to that travesty of a cast.
http://stackoverflow.com/questions/43476183/delphi-thashsha2-return-a-wrong-sha256-on-huge-file
David Heffernan Absolutely. This is also my focus. Well, beside fixing the issue...
ReplyDeleteMarco Cantù Thank you
ReplyDeleteMy eyes!
ReplyDelete