--- parser3/src/classes/math.C 2003/04/15 14:30:14 1.30 +++ parser3/src/classes/math.C 2003/07/24 08:19:20 1.33.2.1 @@ -8,7 +8,7 @@ Copyright (C) 1996, 1997, 1998, 1999 Theodore Ts'o. */ -static const char* IDENT_MATH_C="$Date: 2003/04/15 14:30:14 $"; +static const char* IDENT_MATH_C="$Date: 2003/07/24 08:19:20 $"; #include "pa_common.h" #include "pa_vint.h" @@ -148,7 +148,7 @@ static void random(void *buffer, size_t static inline int _random(uint top) { uint raw; random(&raw, sizeof(raw)); - return int(double(raw) / 0x100000000 * top ); + return int(double(raw) / 0xFFFFFFFFu * top ); } static void _random(Request& r, const String& method_name, MethodParams *params) { Pool& pool=r.pool(); @@ -260,7 +260,7 @@ static void _crypt(Request& r, const Str const size_t sample_size=120; char *sample_buf=(char *)pool.malloc(sample_size); PA_MD5Encode((const unsigned char *)password, - (const unsigned char *)normal_salt, 1/*TRUE: mix in magic string*/, + (const unsigned char *)normal_salt, sample_buf, sample_size); r.write_pass_lang(*new(pool) String(pool, sample_buf)); } else { @@ -287,9 +287,15 @@ static const char* hex_string(Pool& pool 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"; - while(src