From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Adding sha256 and sha512 to C? Date: Fri, 27 May 2011 20:58:38 -0700 Organization: UCLA Computer Science Department Message-ID: <4DE072EE.4030303@cs.ucla.edu> References: <19936.26998.559386.371174@priss.frightenedpiglet.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1306555135 2232 80.91.229.12 (28 May 2011 03:58:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 28 May 2011 03:58:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: sand@blarg.net Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 28 05:58:51 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QQAfq-0000JI-DW for ged-emacs-devel@m.gmane.org; Sat, 28 May 2011 05:58:50 +0200 Original-Received: from localhost ([::1]:48884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQAfp-0006pL-Sz for ged-emacs-devel@m.gmane.org; Fri, 27 May 2011 23:58:49 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:41973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQAfo-0006pF-7H for emacs-devel@gnu.org; Fri, 27 May 2011 23:58:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQAfn-0004fN-5s for emacs-devel@gnu.org; Fri, 27 May 2011 23:58:48 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:57830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQAfm-0004fH-Vs for emacs-devel@gnu.org; Fri, 27 May 2011 23:58:47 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id AF06939E810A; Fri, 27 May 2011 20:58:44 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8yo7vLkzfQK8; Fri, 27 May 2011 20:58:43 -0700 (PDT) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id DB26A39E8100; Fri, 27 May 2011 20:58:43 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 In-Reply-To: <19936.26998.559386.371174@priss.frightenedpiglet.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:139813 Archived-At: On 05/27/11 20:18, sand@blarg.net wrote: > The gnulib crypto library also has sha256 and sha512 > functions; is there any objection to adding those as well? 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) 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))