Function: md5

md5 is a function defined in fns.c.

Signature

(md5 OBJECT &optional START END CODING-SYSTEM NOERROR)

Documentation

Return MD5 message digest of OBJECT, a buffer or string.

A message digest is the string representation of the cryptographic checksum of a document, and the algorithm to calculate it is defined in RFC 1321. The MD5 digest is 32-character long.

The two optional arguments START and END are character positions specifying for which part of OBJECT the message digest should be computed. If nil or omitted, the digest is computed for the whole OBJECT.

The MD5 message digest is computed from the result of encoding the text in a coding system, not directly from the internal Emacs form of the text. The optional fourth argument CODING-SYSTEM specifies which coding system to encode the text with. It should be the same coding system that you used or will use when actually writing the text into a file.

If CODING-SYSTEM is nil or omitted, the default depends on OBJECT. If OBJECT is a buffer, the default for CODING-SYSTEM is whatever coding system would be chosen by default for writing this text into a file.

If OBJECT is a string, the most preferred coding system (see the command prefer-coding-system) is used.

If NOERROR is non-nil, silently assume the raw-text coding if the guesswork fails. Normally, an error is signaled in such case.

Note that MD5 is not collision resistant and should not be used for anything security-related. See secure-hash for alternatives.

View in manual

Probably introduced at or before Emacs version 21.1.

Source Code

// Defined in /usr/src/emacs/src/fns.c
{
  return secure_hash (Qmd5, object, start, end, coding_system, noerror, Qnil);
}