2 * General routines for handling the various checksum supported.
5 Copyright (C) 2000-2005 Kern Sibbald
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as amended with additional clauses defined in the
10 file LICENSE in the main source directory.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 the file LICENSE for additional details.
25 * Link these to findlib options. Doing so allows for simpler handling of
26 * signatures in the callers.
27 * If multiple signatures are specified, the order in chksum_init() matters.
28 * Still, spell out our own names in case we want to change the approach.
31 #define CHKSUM_MD5 FO_MD5
32 #define CHKSUM_SHA1 FO_SHA1
40 int type; /* One of CHKSUM_* above */
41 char name[5]; /* Big enough for NONE, MD5, SHA1, etc. */
42 bool updated; /* True if updated by chksum_update() */
43 chksumContext context; /* Context for the algorithm at hand */
44 int length; /* Length of signature */
45 unsigned char signature[30]; /* Large enough for either signature */
48 int chksum_init(CHKSUM *chksum, int flags);
49 int chksum_update(CHKSUM *chksum, void *buf, unsigned len);
50 int chksum_final(CHKSUM *chksum);