From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Kangas <stefan@marxist.se>
Cc: 45178@debbugs.gnu.org
Subject: bug#45178: buffer-hash docstring should explain difference to secure-hash
Date: Fri, 11 Dec 2020 17:00:45 +0100 [thread overview]
Message-ID: <87mtyk8h8y.fsf@gnus.org> (raw)
In-Reply-To: <CADwFkm=grDUvc=zSXV-aSyusW-AinM4yggjeE3BxHE7GaEgMXA@mail.gmail.com> (Stefan Kangas's message of "Fri, 11 Dec 2020 08:41:20 -0600")
Stefan Kangas <stefan@marxist.se> writes:
> 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.
I thought the buffer-hash doc string made the use case pretty clear:
----
This function is useful for comparing two buffers running in the same
Emacs, but is not guaranteed to return the same hash between different
Emacs versions.
----
The only use case for the function is to compare two buffers in the same
running Emacs image. It shouldn't be used for anything else.
> 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.
I think that would be pointing people in the wrong direction.
`secure-hash' is the right thing to use in 99% of the cases.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2020-12-11 16:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=87mtyk8h8y.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=45178@debbugs.gnu.org \
--cc=stefan@marxist.se \
/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).