Mercurial > hg > nginx
comparison src/core/ngx_string.c @ 1745:ec63069aeb78
replace ngx_md5_text() with ngx_hex_dump()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 17 Dec 2007 21:06:17 +0000 |
parents | 12a656452ad1 |
children | d85879105d35 |
comparison
equal
deleted
inserted
replaced
1744:d65172100f6b | 1745:ec63069aeb78 |
---|---|
814 return value; | 814 return value; |
815 } | 815 } |
816 } | 816 } |
817 | 817 |
818 | 818 |
819 void | 819 u_char * |
820 ngx_md5_text(u_char *text, u_char *md5) | 820 ngx_hex_dump(u_char *dst, u_char *src, size_t len) |
821 { | 821 { |
822 int i; | |
823 static u_char hex[] = "0123456789abcdef"; | 822 static u_char hex[] = "0123456789abcdef"; |
824 | 823 |
825 for (i = 0; i < 16; i++) { | 824 while (len--) { |
826 *text++ = hex[md5[i] >> 4]; | 825 *dst++ = hex[*src >> 4]; |
827 *text++ = hex[md5[i] & 0xf]; | 826 *dst++ = hex[*src++ & 0xf]; |
828 } | 827 } |
829 | 828 |
830 *text = '\0'; | 829 return dst; |
831 } | 830 } |
832 | 831 |
833 | 832 |
834 void | 833 void |
835 ngx_encode_base64(ngx_str_t *dst, ngx_str_t *src) | 834 ngx_encode_base64(ngx_str_t *dst, ngx_str_t *src) |