1 /***************************************************************************
2 * Copyright (C) 2007 by SukkoPera *
3 * sukkopera@sukkology.net *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef MULTIHASH_H_INCLUDED
22 #define MULTIHASH_H_INCLUDED
27 /* Definition of the types we use for Windows */
29 #define u_int16_t WORD
30 #define u_int32_t DWORD
32 /* Modern MSVC/UCRT provides snprintf; do not macro-alias it. */
34 /* Stuff to export library symbols */
35 #ifdef MULTIHASH_BUILD_DLL
36 #ifdef MULTIHASH_EXPORTS
37 #define MULTIHASH_EXPORT __declspec(dllexport) /* Building the lib */
39 #define MULTIHASH_EXPORT __declspec(dllimport) /* Building user code */
42 #define MULTIHASH_EXPORT
47 #define MULTIHASH_EXPORT
64 #include <sys/types.h>
72 #define MD4_DIGESTSIZE 16
95 /* This must be as long as the longest hash (in bytes) */
96 #define MAX_DIGESTSIZE 32
101 char crc32_s[LEN_CRC32 + 1];
105 char md4_s[LEN_MD4 + 1];
109 char md5_s[LEN_MD5 + 1];
112 ed2khash_context ed2k;
113 char ed2k_s[LEN_ED2K + 1];
117 char sha1_s[LEN_SHA1 + 1];
121 char sha2_s[LEN_SHA2 + 1];
127 MULTIHASH_EXPORT void multihash_init (multihash *mh);
128 MULTIHASH_EXPORT void multihash_update (multihash *mh, unsigned char *data, int bytes);
129 MULTIHASH_EXPORT void multihash_finish (multihash *mh);
130 MULTIHASH_EXPORT int multihash_file (multihash *mh, char *filename);