| 51 | #include "util_ebcdic.h" |
| 52 | |
| 53 | AP_DECLARE(char *) ap_md5_binary(apr_pool_t *p, const unsigned char *buf, int length) |
| 54 | { |
| 55 | apr_md5_ctx_t my_md5; |
| 56 | unsigned char hash[APR_MD5_DIGESTSIZE]; |
| 57 | char *result; |
| 58 | |
| 59 | /* |
| 60 | * Take the MD5 hash of the string argument. |
| 61 | */ |
| 62 | |
| 63 | apr_md5_init(&my_md5); |
| 64 | #if APR_CHARSET_EBCDIC |
| 65 | apr_md5_set_xlate(&my_md5, ap_hdrs_to_ascii); |
| 66 | #endif |
| 67 | apr_md5_update(&my_md5, buf, (unsigned int)length); |
| 68 | apr_md5_final(hash, &my_md5); |
| 69 | |
| 70 | result = apr_palloc(p, 2 * APR_MD5_DIGESTSIZE + 1); |
| 71 | ap_bin2hex(hash, APR_MD5_DIGESTSIZE, result); /* sets final '\0' */ |
| 72 | return result; |
| 73 | } |
| 74 | |
| 75 | AP_DECLARE(char *) ap_md5(apr_pool_t *p, const unsigned char *string) |
| 76 | { |
no test coverage detected