MD5 Message Digest Unit

   
Release: 1.0
Date: 18 July 2011
Delphi Compatibility:
 D1   D2   D3   D4   D5   D6   D7  D2005 D2006 D2007 D2009 D2010  DXE  DXE2
Red LED Red LED Red LED Red LED Red LED Red LED Red LED Red LED Red LED Red LED Grey LED Green LED Green LED Grey LED

About the Unit

Introduction

This unit contains an implementation of the MD5 message digest algorithm. It is implemented as a Delphi class named TPJMD5.

The code was developed from scratch based on the algorithm presented in RFC 1321. Portions of the code are translated from the reference C code supplied in the RFC. However the code is not a literal translation into Pascal from the reference C code.

The algorithm and reference code are copyright © 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved.

The unit is maintained as part of the Delphi Dabbler Code Library project on GoogleCode.

Documentation

The component is documented in the MD5 Message Digest Unit Wiki.

Testing

DUnit tests for the unit are supplied in the download. The tests include those specified in RFC 1321.

Bugs & Feature Requests

Please report any bugs you find using the Issue Tracker Please state that you are reporting a bug in the MD5 Message Digest Unit since the issue tracker is shared between different library components and classes. Do this by changing the Project-unspecified label to Project-md5.

You can request new features using the same Issue Tracker that is used to report bugs. When creating a new feature request make sure you change the Template from Defect Report from User to Feature Request and change the Project-unspecified label to Project-md5.

Rationale

So why write this code?

Well, I've been searching for an up-to-date implementation of the MD5 algorithm that meets these criteria:

  1. No dependency on .obj files or DLLs. I want pure Pascal code.
  2. Open source with a license compatible with the Mozilla Public License because I want to use it in an MPLd application of mine, so GPL-only code is ruled out.
  3. Compiles and works with the Unicode Delphi Compilers.
  4. Object oriented.
  5. Easy to get an MD5 digest from all sorts of data without messing about converting it and playing around with contexts etc.

The implementation I've been using up until now meets only the first 2 criteria. And it is no longer being updated. And it took me quite some time to persuade it to work in the Unicode world of Delphi 2010.

It somehow seemed easier to start again. After a couple of false starts, this is the result.