1 Return-Path: <david@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 286F7431FC3
\r
6 for <notmuch@notmuchmail.org>; Sun, 24 Nov 2013 04:40:26 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id dbLy3H6rEdLq for <notmuch@notmuchmail.org>;
\r
16 Sun, 24 Nov 2013 04:40:22 -0800 (PST)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id E6A86431FBF
\r
21 for <notmuch@notmuchmail.org>; Sun, 24 Nov 2013 04:40:21 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <david@tethera.net>)
\r
24 id 1VkYz2-0006xt-OJ; Sun, 24 Nov 2013 08:40:16 -0400
\r
25 Received: (nullmailer pid 4921 invoked by uid 1000); Sun, 24 Nov 2013
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: Re: notmuch sha1 implementation broken on (some) big-endian
\r
31 In-Reply-To: <87eh666mhp.fsf@zancas.localnet>
\r
32 References: <87eh666mhp.fsf@zancas.localnet>
\r
33 User-Agent: Notmuch/0.17~rc1 (http://notmuchmail.org) Emacs/24.3.1
\r
34 (x86_64-pc-linux-gnu)
\r
35 Date: Sun, 24 Nov 2013 08:40:13 -0400
\r
36 Message-ID: <87bo1a6kia.fsf@zancas.localnet>
\r
38 Content-Type: text/plain
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Sun, 24 Nov 2013 12:40:26 -0000
\r
53 David Bremner <david@tethera.net> writes:
\r
55 > The following code, when linked with libnotmuch.a and libutil.a does a
\r
56 > passable imitation of sha1sum on amd64 (and I guess also i386) but
\r
57 > computes a different digest on powerpc and probably sparc and s390x.
\r
59 > In the long run we should maybe outsource hash computations to
\r
60 > e.g. librhash, but I'd like a simpler fix for 0.17, if possible
\r
62 Out of curiousity, I tried out a similar example with librhash, and it
\r
63 works fine on powerpc.
\r
66 #include "rhash.h" /* LibRHash interface */
\r
68 int main(int argc, char *argv[])
\r
73 rhash_library_init(); /* initialize static data */
\r
75 int res = rhash_file(RHASH_SHA1, argv[1], digest);
\r
77 fprintf(stderr, "LibRHash error: %s: %s\n", argv[1], strerror(errno));
\r
81 /* convert binary digest to hexadecimal string */
\r
82 rhash_print_bytes(output, digest, rhash_get_digest_size(RHASH_SHA1),RHPR_HEX);
\r
84 printf("%s (%s) = %s\n", rhash_get_name(RHASH_SHA1), argv[1], output);
\r