unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: sand@blarg.net, Leo <sdl.web@gmail.com>,
	monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: Adding sha256 and sha512 to C?
Date: Sat, 11 Jun 2011 09:02:36 -0700	[thread overview]
Message-ID: <4DF3919C.9070907@cs.ucla.edu> (raw)
In-Reply-To: <834o3wbdbw.fsf@gnu.org>

On 06/11/11 08:24, Eli Zaretskii wrote:

> Like this:
> 
>  (sha2 OBJECT &optional BEG END BINARY ALGORITHM)
> 
> where ALGORITHM can be sha-224, sha-256, etc.
> 
> (We could have ALGORITHM the 3rd argument, if keeping a signature
> compatible with sha1 is not important.)

Or better yet:

 (crypto-hash-function ALGORITHM OBJECT
    &optional START END NOERROR BINARY)

as was discussed in <http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00872.html>
and the ensuing thread.  The above suggestion removes
the previously-proposed CODING-SYSTEM argument that Stefan
didn't think was needed, which means that people who want
md5's CODING-SYSTEM feature would have to invoke the md5
function directly.

The advantage of this approach is that we don't pollute
the Lisp namespace with one function name per algorithm.

Some other comments:

Please modify GNULIB_MODULES in Makefile.in to reflect
the new dependencies.

No need to use EMACS_UINT for digest_size.  Please use
plain 'int'.  We prefer to not use unsigned types due
to problems when they're used in comparisons.

No need to use sizeof (char).  It is always 1.

Please write "F (ARGS)" rather than "F(ARGS)".

When creating the digest the code should use make_unibyte_string
rather than make_string.  (This comment applies
also to the original.)

Please don't cast function pointers to void * and back, as
that defeats the purpose of the C type checking.  Instead,
just use the unvarnished C types.



  reply	other threads:[~2011-06-11 16:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28  3:18 Adding sha256 and sha512 to C? sand
2011-05-28  3:58 ` Paul Eggert
2011-05-28  7:25   ` Eli Zaretskii
2011-05-30  4:06     ` Stefan Monnier
2011-06-11  5:43       ` Leo
2011-06-11  8:00         ` Eli Zaretskii
2011-06-11 12:37           ` Leo
2011-06-11 15:24             ` Eli Zaretskii
2011-06-11 16:02               ` Paul Eggert [this message]
2011-06-11 20:36                 ` Juanma Barranquero
2011-06-12  0:34                 ` YAMAMOTO Mitsuharu
2011-06-12 13:03                 ` Leo
2011-06-12 14:05                   ` Thien-Thi Nguyen
2011-06-12 15:48                   ` Deniz Dogan
2011-06-12 17:06                     ` Richard Riley
2011-06-12 22:37                   ` Paul Eggert
2011-06-19 16:08                     ` Leo
2011-05-29  4:22   ` Leo
2011-05-29  5:18     ` Paul Eggert

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=4DF3919C.9070907@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=sand@blarg.net \
    --cc=sdl.web@gmail.com \
    /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).