--- parser3/src/classes/math.C 2003/04/15 14:12:15 1.29 +++ parser3/src/classes/math.C 2003/04/25 11:56:36 1.31 @@ -8,7 +8,7 @@ Copyright (C) 1996, 1997, 1998, 1999 Theodore Ts'o. */ -static const char* IDENT_MATH_C="$Date: 2003/04/15 14:12:15 $"; +static const char* IDENT_MATH_C="$Date: 2003/04/25 11:56:36 $"; #include "pa_common.h" #include "pa_vint.h" @@ -282,6 +282,24 @@ static void _crypt(Request& r, const Str } } +static const char* hex_string(Pool& pool, unsigned char* bytes, size_t size, bool upcase) { + char *bytes_hex=(char *)pool.malloc(size*2/*byte->hh*/+1/*for zero-teminator*/); + unsigned char *src=bytes; + unsigned char *end=bytes+size; + char *dest=bytes_hex; + + static const char *hex=upcase?"0123456789ABCDEF":"0123456789abcdef"; + + const char *format=upcase?"%02X":"%02x"; + for(; srcas_string(0, "parameter must be string").cstr(); @@ -293,14 +311,8 @@ static void _md5(Request& r, const Strin PA_MD5Update(&context, (const unsigned char*)string, strlen(string)); PA_MD5Final(digest, &context); - char *digest_bytes_hex=(char *)pool.malloc(sizeof(digest)*2/*byte->hh*/+1/*for zero-teminator*/); - unsigned char *src=digest; - unsigned char *end=digest+sizeof(digest); - char *dest=digest_bytes_hex; - while(src