! \brief * Calculate a MD5 digests over a string array and stores * the result in the destination char array. * This function assumes 32 bytes in the destination buffer. * \param dest destination * \param src string input array * \param size elements in the input array */
| 44 | * \param size elements in the input array |
| 45 | */ |
| 46 | void MD5StringArray(char *dest, str src[], unsigned int size) |
| 47 | { |
| 48 | MD5_CTX context; |
| 49 | char digest[16]; |
| 50 | int i, len; |
| 51 | char *tmp; |
| 52 | |
| 53 | MD5Init (&context); |
| 54 | for (i=0; i < size; i++) { |
| 55 | trim_len(len, tmp, src[i]); |
| 56 | MD5Update(&context, tmp, len); |
| 57 | } |
| 58 | MD5Final(digest, &context); |
| 59 | |
| 60 | string2hex(digest, 16, dest); |
| 61 | LM_DBG("MD5 calculated: %.*s\n", MD5_LEN, dest); |
| 62 | } |
| 63 | |
| 64 | /*! \brief |
| 65 | * Calculate a MD5 digest over a file. |
no test coverage detected