Sign in Join
Wiki copytemporary

hash

English · Français · Русский

The package hash contains implementations for CRC, MD5, NTLM (1?) and, under Linux, crypt. Crypt might be better used from pkg "user".

Unit md5

This unit implements the MD5 digest algorithm according to the specifications in RFC 1321. There are routines to calculate hashes from some buffer, or a hash from an entire file.

The test program md5test calculates the hash value for some reference string. The reference output is provided for comparison.

A simple way to calculate the MD5 of a given string is to use MD5String followed by MD5Print, like this:

pascal
uses md5;

var
  Password, PasswordHash: string;
begin
  PasswordHash := MD5Print(MD5String(Password));

Similarly, to generate the MD5 hash of a file one can use:

pascal
uses md5;

var
  PathToFile, FileHash: string;
begin
  FileHash := MD5Print(MD5File(PathToFile));

Hash units

The following hash units are available in FPC:

See also

Go back to Packages List


From the Free Pascal wiki, page "hash", as it stood on 2020-02-16 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.