diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-02-18 05:29:31 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-02-18 05:29:31 +0000 |
commit | 7a6d02f3ea32915de7d0d170bbd2ce593373731a (patch) | |
tree | 2a7cff1aeac30709de9df732edec9fb2a1882327 /utils.c | |
parent | bf6afaf5cb615f1468b79d9bc184e5aeea66b489 (diff) |
Add OEJ's md5 app (bug #3604)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5048 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils.c')
-rwxr-xr-x | utils.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -25,6 +25,7 @@ #include <asterisk/lock.h> #include <asterisk/utils.h> #include <asterisk/logger.h> +#include <asterisk/md5.h> 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; |