Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

Digest property

Project: MD5 Message Digest Unit

Unit: PJMD5

Class: TPJMD5

Applies to: ~>1.0

property Digest: TPJMD5Digest;

Description

This read only property provides access to the current MD5 hash as a TPJMD5Digest record.

Once you have finished adding data to a hash with the Process and ProcessFile methods you should read Digest to get the required MD5 digest of the data.

Reading this property finalizes the hash so that no more data can be added to it. Digest calls Finalize internally and sets the Finalized property to True.

Note

The value of Digest can be assigned to another TPJMD5Digest record or to a Unicode string or TBytes array. This is because TPJMD5Digest overloads the Implicit operator for the string and TBytes types.

Example

Here’s how to display the combined MD5 hash of two files:

var
  MD5: TPJMD5;
begin
  MD5 := TPJMD5.Create;
  try
    MD5.ProcessFile('MyFile1.txt');
    MD5.ProcessFile('MyFile2.txt');
    ShowMessage(MD5.Digest);
  finally
    MD5.Free;
  end;
end;

The ShowMessage call relies on the fact that Digest can be implicitly cast to a string.