summaryrefslogtreecommitdiff
path: root/src/fns.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2023-02-11 12:28:43 +0200
committerEli Zaretskii <eliz@gnu.org>2023-02-11 12:28:43 +0200
commit2d1e43436da93defe13ad125de46e3bce41172c3 (patch)
tree29c360e78e4409d59146ec38a43ef245293498b5 /src/fns.c
parent900f7e07275405d8e40ce19b91eca3f5b0f3a870 (diff)
downloademacs-2d1e43436da93defe13ad125de46e3bce41172c3.tar.gz
; Improve documentation of hash functions.
* src/fns.c (Fsecure_hash, Fmd5): Document the length of the return values. * lisp/subr.el (sha1): Describe the return value in more detail. * doc/lispref/text.texi (Checksum/Hash): Document 'sha1'. Document the length of the strings returned by each hashing algorithm.
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/fns.c b/src/fns.c
index 3984e318feb..ff364c65e26 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -5804,8 +5804,9 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start,
DEFUN ("md5", Fmd5, Smd5, 1, 5, 0,
doc: /* Return MD5 message digest of OBJECT, a buffer or string.
-A message digest is a cryptographic checksum of a document, and the
-algorithm to calculate it is defined in RFC 1321.
+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
@@ -5839,12 +5840,12 @@ anything security-related. See `secure-hash' for alternatives. */)
DEFUN ("secure-hash", Fsecure_hash, Ssecure_hash, 2, 5, 0,
doc: /* 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)
+- md5 corresponds to MD5, produces a 32-character signature
+- sha1 corresponds to SHA-1, produces a 40-character signature
+- sha224 corresponds to SHA-2 (SHA-224), produces a 56-character signature
+- sha256 corresponds to SHA-2 (SHA-256), produces a 64-character signature
+- sha384 corresponds to SHA-2 (SHA-384), produces a 96-character signature
+- sha512 corresponds to SHA-2 (SHA-512), produces a 128-character signature
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