File indexing completed on 2025-01-05 04:27:02

0001 /****************************************************************************************
0002  * Copyright (c) 1995,1996 Free Software Foundation Inc. <info@fsf.org>                 *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016  
0017 #ifndef _LIBMP3TUNES_MD5_H
0018 #define _LIBMP3TUNES_MD5_H
0019 
0020 #include <stdlib.h>
0021 #include <string.h>
0022 
0023 #define MD5_SIZE    16
0024 #define HEX_STRING  "0123456789abcdef"  /* to convert to hex */
0025 /*#include <sys/types.h>*/
0026 
0027 /*
0028  * md5_sig_to_string
0029  *
0030  * DESCRIPTION:
0031  *
0032  * Convert a MD5 signature in a 16 byte buffer into a hexadecimal string
0033  * representation.
0034  *
0035  * RETURNS:
0036  *
0037  * None.
0038  *
0039  * ARGUMENTS:
0040  *
0041  * signature - a 16 byte buffer that contains the MD5 signature.
0042  *
0043  * str - a string of characters which should be at least 33 bytes long (2
0044  * characters per MD5 byte and 1 for the \0).
0045  *
0046  * str_len - the length of the string.
0047  */
0048 void md5_sig_to_string(void *signature, char *str, const int str_len);
0049 
0050 /*
0051  * md5_calc_file_signature
0052  *
0053  * DESCRIPTION:
0054  *
0055  * Calculates MD5 signature of the specified file contents and returns
0056  * hexadecimal representation of the signature.
0057  *
0058  * RETURNS:
0059  *
0060  * Hexadecimal representation of the signature of NULL if it could not be
0061  * calculated. The returned pointer should be freed with the free()
0062  * function when it is no longer needed.
0063  *
0064  * ARGUMENTS:
0065  *
0066  * filename - a path to the file which MD5 signature should be calculated.
0067  */
0068 char* md5_calc_file_signature(const char *filename);
0069 
0070 #endif