2 * General routines for handling the various checksum supported.
6 Copyright (C) 2004 Kern Sibbald
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of
11 the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public
19 License along with this program; if not, write to the Free
20 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
31 * Link these to findlib options. Doing so allows for simpler handling of
32 * signatures in the callers.
33 * If multiple signatures are specified, the order in chksum_init() matters.
34 * Still, spell out our own names in case we want to change the approach.
37 #define CHKSUM_MD5 FO_MD5
38 #define CHKSUM_SHA1 FO_SHA1
46 int type; /* One of CHKSUM_* above */
47 char name[5]; /* Big enough for NONE, MD5, SHA1, etc. */
48 bool updated; /* True if updated by chksum_update() */
49 chksumContext context; /* Context for the algorithm at hand */
50 int length; /* Length of signature */
51 unsigned char signature[30]; /* Large enough for either signature */
54 int chksum_init(CHKSUM *chksum, int flags);
55 int chksum_update(CHKSUM *chksum, void *buf, unsigned len);
56 int chksum_final(CHKSUM *chksum);