changed sock_read() in some files to sock_gets().
[claws.git] / src / md5.h
1 /* md5.h - MD5 Message-Digest Algorithm
2  *      Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
3  *
4  * according to the definition of MD5 in RFC 1321 from April 1992.
5  * NOTE: This is *not* the same file as the one from glibc
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the
9  * Free Software Foundation; either version 2, or (at your option) any
10  * later version.
11  *
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  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef _MD5_HDR_
23 #define _MD5_HDR_
24
25 #include "utils.h"
26
27 typedef struct {  /* Hmm, should be private */
28     u32 A,B,C,D;
29     u32  nblocks;
30     unsigned char buf[64];
31     int  count;
32     int  finalized;
33 } MD5_CONTEXT;
34
35 typedef MD5_CONTEXT MD5_CTX;
36
37 void md5_init(MD5_CONTEXT *ctx);
38 void md5_update(MD5_CONTEXT *hd, const unsigned char *inbuf, size_t inlen);
39 void md5_final(unsigned char *digest, MD5_CONTEXT *ctx);
40
41 void md5_hex_digest(char *hexdigest, const unsigned char *s);
42
43 void md5_hmac(unsigned char *digest,
44               const unsigned char* text, int text_len,
45               const unsigned char* key, int key_len);
46 void md5_hex_hmac(char *hexdigest,
47                   const unsigned char* text, int text_len,
48                   const unsigned char* key, int key_len);
49
50 #endif /* _MD5_HDR_ */
51