From 627a6dbb5ac317a8341bbde84a3789d733b5a96f Mon Sep 17 00:00:00 2001 From: Sergey Lyubka <valenok@gmail.com> Date: Wed, 5 May 2010 00:39:36 +0100 Subject: [PATCH] mg_md5 made public --- mongoose.c | 2 +- mongoose.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mongoose.c b/mongoose.c index 2332f21f8..9fbb0ec90 100644 --- a/mongoose.c +++ b/mongoose.c @@ -2120,7 +2120,7 @@ bin2str(char *to, const unsigned char *p, size_t len) * Return stringified MD5 hash for list of vectors. * buf must point to 33-bytes long buffer */ -static void +void mg_md5(char *buf, ...) { unsigned char hash[16]; diff --git a/mongoose.h b/mongoose.h index c3c8834ef..6c9218f7b 100644 --- a/mongoose.h +++ b/mongoose.h @@ -236,6 +236,17 @@ enum mg_error_t mg_get_cookie(const struct mg_connection *, const char *mg_version(void); +/* + * MD5 hash given strings. + * Buffer 'buf' must be 33 bytes long. Varargs is a NULL terminated list of + * asciiz strings. When function returns, buf will contain human-readable + * MD5 hash. Example: + * char buf[33]; + * mg_md5(buf, "aa", "bb", NULL); + */ +void mg_md5(char *buf, ...); + + /* * Print command line usage string. */ -- GitLab