Function: secure-hash

secure-hash is a function defined in fns.c.

Signature

(secure-hash ALGORITHM OBJECT &optional START END BINARY)

Documentation

Return the secure hash of OBJECT, a buffer or string.

ALGORITHM is a symbol specifying the hash to use:
- md5 corresponds to MD5
- sha1 corresponds to SHA-1
- sha224 corresponds to SHA-2 (SHA-224)
- sha256 corresponds to SHA-2 (SHA-256)
- sha384 corresponds to SHA-2 (SHA-384)
- sha512 corresponds to SHA-2 (SHA-512)

The two optional arguments START and END are positions specifying for which part of OBJECT to compute the hash. If nil or omitted, uses the whole OBJECT.

The full list of algorithms can be obtained with secure-hash-algorithms.

If BINARY is non-nil, returns a string in binary form.

Note that MD5 and SHA-1 are not collision resistant and should not be used for anything security-related. For these applications, use one of the other hash types instead, e.g. sha256 or sha512.

Probably introduced at or before Emacs version 24.1.

Source Code

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