notmuch sha1 implementation broken on (some) big-endian architectures
David Bremner
david at tethera.net
Sun Nov 24 03:57:22 PST 2013
The following code, when linked with libnotmuch.a and libutil.a does a
passable imitation of sha1sum on amd64 (and I guess also i386) but
computes a different digest on powerpc and probably sparc and s390x.
In the long run we should maybe outsource hash computations to
e.g. librhash, but I'd like a simpler fix for 0.17, if possible
P.S. I blame Austin for adding the "missing-headers" test which found
this bug ;).
/* 8<----------------------------------------- */
#include <stdio.h>
#include "notmuch.h"
char * notmuch_sha1_of_file(const char* filename);
int
main (int argc, char **argv)
{
char *digest = notmuch_sha1_of_file (argv[1]);
printf("%s %s\n",digest,argv[1]);
return 0;
}
More information about the notmuch
mailing list