From 0126706cac414623d72d7849fa39af87074e721c Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Fri, 18 Feb 2005 05:29:31 +0000 Subject: Add OEJ's md5 app (bug #3604) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5048 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- utils.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'utils.c') diff --git a/utils.c b/utils.c index 685a66aa1..0d7a8781c 100755 --- a/utils.c +++ b/utils.c @@ -25,6 +25,7 @@ #include #include #include +#include static char base64[64]; static char b2a[256]; @@ -245,6 +246,21 @@ int test_for_thread_safety(void) return(test_errors); /* return 0 on success. */ } +/*--- ast_md5_hash: Produce 16 char MD5 hash of value. ---*/ +void ast_md5_hash(char *output, char *input) +{ + struct MD5Context md5; + unsigned char digest[16]; + char *ptr; + int x; + MD5Init(&md5); + MD5Update(&md5, input, strlen(input)); + MD5Final(digest, &md5); + ptr = output; + for (x=0;x<16;x++) + ptr += sprintf(ptr, "%2.2x", digest[x]); +} + int ast_base64decode(unsigned char *dst, char *src, int max) { int cnt = 0; -- cgit v1.2.3