www.delorie.com/gnu/docs/elisp-manual-21/elisp_539.html   search  
Buy the book!

GNU Emacs Lisp Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

32.24 MD5 Checksum

MD5 cryptographic checksums, or message digests, are 128-bit "fingerprints" of a document or program. They are used to verify that you have an exact and unaltered copy of the data. The algorithm to calculate the MD5 message digest is defined in Internet RFC(8)1321. This section describes the Emacs facilities for computing message digests.

Function: md5 object &optional start end coding-system noerror
This function returns the MD5 message digest of object, which should be a buffer or a string.

The two optional arguments start and end are character positions specifying the portion of object to compute the message digest for. If they are nil or omitted, the digest is computed for the whole of object.

The function md5 does not compute the message digest directly from the internal Emacs representation of the text (see section 33.1 Text Representations). Instead, it encodes the text using a coding system, and computes the message digest from the encoded text. The optional fourth argument coding-system specifies which coding system to use for encoding the text. It should be the same coding system that you used to read the text, or that you used or will use when saving or sending the text. See section 33.10 Coding Systems, for more information about coding systems.

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 user's most preferred coding system (see section `the description of prefer-coding-system' in GNU Emacs Manual) is used.

Normally, md5 signals an error if the text can't be encoded using the specified or chosen coding system. However, if noerror is non-nil, it silently uses raw-text coding instead.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003