2 * General routines for handling the various checksum supported.
6 Copyright (C) 2000-2004 Kern Sibbald and John Walker
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);
60 * General routines for handling the various checksum supported.
64 Copyright (C) 2004 Kern Sibbald
66 This program is free software; you can redistribute it and/or
67 modify it under the terms of the GNU General Public License as
68 published by the Free Software Foundation; either version 2 of
69 the License, or (at your option) any later version.
71 This program is distributed in the hope that it will be useful,
72 but WITHOUT ANY WARRANTY; without even the implied warranty of
73 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74 General Public License for more details.
76 You should have received a copy of the GNU General Public
77 License along with this program; if not, write to the Free
78 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
89 * Link these to findlib options. Doing so allows for simpler handling of
90 * signatures in the callers.
91 * If multiple signatures are specified, the order in chksum_init() matters.
92 * Still, spell out our own names in case we want to change the approach.
95 #define CHKSUM_MD5 FO_MD5
96 #define CHKSUM_SHA1 FO_SHA1
104 int type; /* One of CHKSUM_* above */
105 char name[5]; /* Big enough for NONE, MD5, SHA1, etc. */
106 bool updated; /* True if updated by chksum_update() */
107 chksumContext context; /* Context for the algorithm at hand */
108 int length; /* Length of signature */
109 unsigned char signature[30]; /* Large enough for either signature */
112 int chksum_init(CHKSUM *chksum, int flags);
113 int chksum_update(CHKSUM *chksum, void *buf, unsigned len);
114 int chksum_final(CHKSUM *chksum);