replace ngx_md5_text() with ngx_hex_dump()

This commit is contained in:
Igor Sysoev 2007-12-17 21:06:17 +00:00
parent 249cbe75b4
commit a03fa3666f
2 changed files with 7 additions and 8 deletions

View File

@ -816,18 +816,17 @@ ngx_hextoi(u_char *line, size_t n)
} }
void u_char *
ngx_md5_text(u_char *text, u_char *md5) ngx_hex_dump(u_char *dst, u_char *src, size_t len)
{ {
int i;
static u_char hex[] = "0123456789abcdef"; static u_char hex[] = "0123456789abcdef";
for (i = 0; i < 16; i++) { while (len--) {
*text++ = hex[md5[i] >> 4]; *dst++ = hex[*src >> 4];
*text++ = hex[md5[i] & 0xf]; *dst++ = hex[*src++ & 0xf];
} }
*text = '\0'; return dst;
} }

View File

@ -141,7 +141,7 @@ off_t ngx_atoof(u_char *line, size_t n);
time_t ngx_atotm(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); 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) #define ngx_base64_encoded_length(len) (((len + 2) / 3) * 4)