# HG changeset patch # User rtogni # Date 1176154009 0 # Node ID 6bfd7e9775bc4e56947b0de1ec13e28c0663e0b8 # Parent 8258605fb3b29ce81380fa28e1c47bd94524abc7 Simplify calc_response_string() diff -r 8258605fb3b2 -r 6bfd7e9775bc stream/realrtsp/real.c --- a/stream/realrtsp/real.c Mon Apr 09 20:43:48 2007 +0000 +++ b/stream/realrtsp/real.c Mon Apr 09 21:26:49 2007 +0000 @@ -86,21 +86,14 @@ static void calc_response_string (char *result, char *challenge) { - char zres[16]; + unsigned char zres[16]; int i; av_md5_sum(zres, challenge, 64); /* convert zres to ascii string */ - for (i=0; i<16; i++ ) { - char a, b; - - a = (zres[i] >> 4) & 15; - b = zres[i] & 15; - - result[i*2] = ((a<10) ? (a+48) : (a+87)) & 255; - result[i*2+1] = ((b<10) ? (b+48) : (b+87)) & 255; - } + for (i=0; i<16; i++ ) + sprintf(result+i*2, "%02x", zres[i]); } static void real_calc_response_and_checksum (char *response, char *chksum, char *challenge) {