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