From: Stefan Kangas <stefan@marxist.se>
To: 45178@debbugs.gnu.org
Cc: larsi@gnus.org
Subject: bug#45178: buffer-hash docstring should explain difference to secure-hash
Date: Fri, 11 Dec 2020 08:41:20 -0600 [thread overview]
Message-ID: <CADwFkm=grDUvc=zSXV-aSyusW-AinM4yggjeE3BxHE7GaEgMXA@mail.gmail.com> (raw)
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.)
next reply other threads:[~2020-12-11 14:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-11 14:41 Stefan Kangas [this message]
2020-12-11 16:00 ` bug#45178: buffer-hash docstring should explain difference to secure-hash 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADwFkm=grDUvc=zSXV-aSyusW-AinM4yggjeE3BxHE7GaEgMXA@mail.gmail.com' \
--to=stefan@marxist.se \
--cc=45178@debbugs.gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).