all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#45178: buffer-hash docstring should explain difference to secure-hash
@ 2020-12-11 14:41 Stefan Kangas
  2020-12-11 16:00 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2020-12-11 14:41 UTC (permalink / raw)
  To: 45178; +Cc: larsi

Severity: minor

It is not clear to me when I would want to use:

    (buffer-hash (current-buffer))

instead of

    (secure-hash 'sha1 (current-buffer))

One obvious difference is that secure-hash respects narrowing, while
buffer-hash doesn't.  But it's not clear to me why I can't just use
save-restrictions+widen instead.  The Elisp manual says: "It should be
somewhat more efficient on larger buffers than ‘secure-hash’ is, and
should not allocate more memory."

First, I think we should add something about this to the docstring of
`buffer-hash'.  Perhaps we should also mention it in the `secure-hash'
docstring.

Second, is the difference all that important?  If so, perhaps we should
look over our uses of `md5', `sha1' and `secure-hash' in our code-base
to ensure we use the more efficient version where applicable.  (For
example in savehist.el and desktop.el.)





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-20 16:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-11 14:41 bug#45178: buffer-hash docstring should explain difference to secure-hash Stefan Kangas
2020-12-11 16:00 ` Lars Ingebrigtsen
2020-12-11 16:40   ` Stefan Kangas
2020-12-11 16:49     ` Lars Ingebrigtsen
2020-12-11 19:19       ` Stefan Kangas
2020-12-20 11:47       ` Basil L. Contovounesios
2020-12-20 16:31         ` Stefan Kangas

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.