Commit graph

4 commits

Author SHA1 Message Date
Carl Worth
6b228e4509 sha1: Add new notmuch_sha1_of_string function
We'll be using this for storing really long terms in the database
and when we just need to look them up, (and never read back the
original data directly from the database). For example, storing
arbitrarily long directory paths in the database along with
mtime timestamps.

Note that if we did want to store arbitrarily long terms and also
be able to read them back, the Xapian folks recommending splitting
the term off with multiple prefixes. See the note near the end
of this page:

http://trac.xapian.org/wiki/FAQ/UniqueIds
2009-10-23 13:54:53 -07:00
Carl Worth
6a4992bc61 Generate message ID (using SHA1) when a mail message contains none.
This is important as we're using the message ID as the unique key
in our database. So previously, all messages with no message ID
would be treated as the same message---not good at all.
2009-10-22 15:31:56 -07:00
Carl Worth
5794496c6e Rename sha1.c to libsha1.c
This way both the .c and .h files have the same name, and all of the
code imported from the "libsha1" implementation is in filenames
matching libsha1.*.

This also gives me room to make my own notmuch_sha1 wrapper functions
in sha1.c.
2009-10-21 23:27:48 -07:00
Mikhail Gusarov
96c0d1c1cb Add sha1.c and libsha1.h for doing SHA-1-based message-ID generation.
This code comes courtesy of Brian Gladman and Mikhail Gusarov.

Both files are available under the GPL and were downloaded as
version 0.2 of libsha1 from git://github.com/dottedmag/libsha1.git
with the following commit:

commit d0f0e7e0dc5ce2d58972cb5a492183c0d4e58433
Author: Mikhail Gusarov <dottedmag@dottedmag.net>
Date:   Mon Oct 20 22:38:47 2008 +0700

    Version bump.

    Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
2009-10-21 21:33:02 -07:00