emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding sha256 and sha512 to C?


From: Leo
Subject: Re: Adding sha256 and sha512 to C?
Date: Sun, 29 May 2011 12:22:59 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3.50 (Mac OS X 10.6.7)

On 2011-05-28 11:58 +0800, Paul Eggert wrote:
> Sounds good, but rather than continue to add crypto functions
> wouldn't it be better to have a single function parameterized by the
> algorithm name?  Something like the following signature:
>
>  (crypto-hash-function ALGORITHM OBJECT
>     &optional START END CODING-SYSTEM NOERROR BINARY)

I like this too.

> Then, we could implement the existing functions this way:
>
> (defun md5 (object &optional start end coding-system noerror)
>    (crypto-hash-function 'md5 object start end coding-system noerror nil))
>
> (define sha1 (object &optional start end binary)
>    (crypto-hash-function 'sha1 object start end nil nil binary))

I think we should have a consistent signature for all these functions. I
propose:

  (OBJECT &optional START END CODING-SYSTEM BINARY)

omitting the NOERROR arg to make the functions easier to call.

Leo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]