md5.h

Go to the documentation of this file.
00001 /*
00002  *  RFC 1321 compliant MD5 implementation
00003  *
00004  *  Copyright (C) 2006-2007  Christophe Devine
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public
00008  *  License, version 2.1 as published by the Free Software Foundation.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Lesser General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Lesser General Public
00016  *  License along with this library.  If not, see
00017  *  <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #ifndef _MD5_H
00021 #define _MD5_H
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 /**
00028  * \internal
00029  * \brief          MD5 context structure
00030  */
00031 typedef struct
00032 {
00033     unsigned long total[2];     /*!< number of bytes processed  */
00034     unsigned long state[4];     /*!< intermediate digest state  */
00035     unsigned char buffer[64];   /*!< data block being processed */
00036 }
00037 md5_context;
00038 
00039 /**
00040  * \internal
00041  * \brief          Output = MD5( input buffer )
00042  *
00043  * \param input    buffer holding the  data
00044  * \param ilen     length of the input data
00045  * \param output   MD5 checksum result
00046  */
00047 void md5( unsigned char *input, int ilen,
00048           unsigned char *output );
00049 
00050 /**
00051  * \internal
00052  * \brief          Output = MD5( file contents )
00053  *
00054  * \param path     input file name
00055  * \param output   MD5 checksum result
00056  *
00057  * \return         0 if successful, 1 if fopen failed,
00058  *                 or 2 if fread failed
00059  */
00060 int md5_file( const char *path, unsigned char *output );
00061 
00062 #ifdef __cplusplus
00063 }
00064 #endif
00065 
00066 #endif /* md5.h */

Generated on Mon Jan 14 23:53:40 2008 for libalpm by  doxygen 1.5.4