2 * RFC 1321 compliant MD5 implementation
4 * Copyright (C) 2006-2010, Brainspark B.V.
6 * This file is part of PolarSSL (http://www.polarssl.org)
7 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 * \brief MD5 context structure
34 unsigned long total
[2]; /*!< number of bytes processed */
35 unsigned long state
[4]; /*!< intermediate digest state */
36 unsigned char buffer
[64]; /*!< data block being processed */
41 * \brief Output = MD5( input buffer )
43 * \param input buffer holding the data
44 * \param ilen length of the input data
45 * \param output MD5 checksum result
47 void md5( const unsigned char *input
, size_t ilen
, unsigned char output
[16] );
50 * \brief Output = MD5( file contents )
52 * \param path input file name
53 * \param output MD5 checksum result
55 * \return 0 if successful, 1 if fopen failed,
56 * or 2 if fread failed
58 int md5_file( const char *path
, unsigned char output
[16] );