Declaration
constructor Create(Algorithm: TIEHashAlgorithm = iehaMD5; Buffered: boolean = true);
Description
Creates a TIEHashStream which will use specified hash algorithm.
If
Buffered is true the stream data is written to a temporary memory stream. This is necessary when Seek and Read methods are required.
// Save image with a unique name (by creating a hash from the jpeg content and using it as the filename)
var
hashStream: TIEHashStream;
begin
ImageEnView1.IO.LoadFromFile('input.jpg');
hashStream := TIEHashStream.Create(iehaMD5);
try
ImageEnView1.IO.SaveToStreamJpeg(hashStream);
hashStream.SaveToFile(hashStream.GetHash()+'.jpg');
finally
hashStream.Free;
end;
end;