ImageEn, unit iexBitmaps

TIEBitmap.GetHash

TIEBitmap.GetHash


Declaration

function GetHash(Algorithm: TIEHashAlgorithm = iehaMD5; SamplesCount: integer = 0): AnsiString;


Description

Calculates the hash (using the specified hash algorithm) of the bitmap and returns the string representation of the hash.
SamplesCount specifies how many samples of the image are used to compute the hash. 0 = Entire image.


Example

// calculates MD5 hash of input.jpg raster bitmap
ImageEnView1.IO.LoadFromFile('input.jpg');
ShowMessage( ImageEnView1.IEBitmap.GetHash() );

// calculates MD5 hash of input.jpg raster bitmap, using just 256 samples
ImageEnView1.IO.LoadFromFile('input.jpg');
ShowMessage( ImageEnView1.IEBitmap.GetHash(iehaMD5, 256) );

// calculates MD5 hash of input.jpg
with TIEHashStream.Create() do
begin
  LoadFromFile('input.jpg');
  ShowMessage( GetHash() );
end;