From a03fa3666f8b01211535eebac162f6ec54dd6b82 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Mon, 17 Dec 2007 21:06:17 +0000 Subject: replace ngx_md5_text() with ngx_hex_dump() --- src/core/ngx_string.c | 13 ++++++------- src/core/ngx_string.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c index 2eaffd60d..f878c559f 100644 --- a/src/core/ngx_string.c +++ b/src/core/ngx_string.c @@ -816,18 +816,17 @@ ngx_hextoi(u_char *line, size_t n) } -void -ngx_md5_text(u_char *text, u_char *md5) +u_char * +ngx_hex_dump(u_char *dst, u_char *src, size_t len) { - int i; static u_char hex[] = "0123456789abcdef"; - for (i = 0; i < 16; i++) { - *text++ = hex[md5[i] >> 4]; - *text++ = hex[md5[i] & 0xf]; + while (len--) { + *dst++ = hex[*src >> 4]; + *dst++ = hex[*src++ & 0xf]; } - *text = '\0'; + return dst; } diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h index 1bca791bf..4fe5cb604 100644 --- a/src/core/ngx_string.h +++ b/src/core/ngx_string.h @@ -141,7 +141,7 @@ off_t ngx_atoof(u_char *line, size_t n); time_t ngx_atotm(u_char *line, size_t n); ngx_int_t ngx_hextoi(u_char *line, size_t n); -void ngx_md5_text(u_char *text, u_char *md5); +u_char *ngx_hex_dump(u_char *dst, u_char *src, size_t len); #define ngx_base64_encoded_length(len) (((len + 2) / 3) * 4) -- cgit