1 /**************************************************************************************** 2 * Copyright (c) 1995,1996 Free Software Foundation Inc. <info@fsf.org> * 3 * * 4 * This program is free software; you can redistribute it and/or modify it under * 5 * the terms of the GNU General Public License as published by the Free Software * 6 * Foundation; either version 2 of the License, or (at your option) any later * 7 * version. * 8 * * 9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 11 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 12 * * 13 * You should have received a copy of the GNU General Public License along with * 14 * this program. If not, see <http://www.gnu.org/licenses/>. * 15 ****************************************************************************************/ 16 17 #ifndef _LIBMP3TUNES_MD5_H 18 #define _LIBMP3TUNES_MD5_H 19 20 #include <stdlib.h> 21 #include <string.h> 22 23 #define MD5_SIZE 16 24 #define HEX_STRING "0123456789abcdef" /* to convert to hex */ 25 /*#include <sys/types.h>*/ 26 27 /* 28 * md5_sig_to_string 29 * 30 * DESCRIPTION: 31 * 32 * Convert a MD5 signature in a 16 byte buffer into a hexadecimal string 33 * representation. 34 * 35 * RETURNS: 36 * 37 * None. 38 * 39 * ARGUMENTS: 40 * 41 * signature - a 16 byte buffer that contains the MD5 signature. 42 * 43 * str - a string of characters which should be at least 33 bytes long (2 44 * characters per MD5 byte and 1 for the \0). 45 * 46 * str_len - the length of the string. 47 */ 48 void md5_sig_to_string(void *signature, char *str, const int str_len); 49 50 /* 51 * md5_calc_file_signature 52 * 53 * DESCRIPTION: 54 * 55 * Calculates MD5 signature of the specified file contents and returns 56 * hexadecimal representation of the signature. 57 * 58 * RETURNS: 59 * 60 * Hexadecimal representation of the signature of NULL if it could not be 61 * calculated. The returned pointer should be freed with the free() 62 * function when it is no longer needed. 63 * 64 * ARGUMENTS: 65 * 66 * filename - a path to the file which MD5 signature should be calculated. 67 */ 68 char* md5_calc_file_signature(const char *filename); 69 70 #endif 71