comparison stream/realrtsp/real.c @ 22943:6bfd7e9775bc

Simplify calc_response_string()
author rtogni
date Mon, 09 Apr 2007 21:26:49 +0000
parents 8258605fb3b2
children 3ab5e609656a
comparison
equal deleted inserted replaced
22942:8258605fb3b2 22943:6bfd7e9775bc
84 #endif 84 #endif
85 85
86 86
87 static void calc_response_string (char *result, char *challenge) { 87 static void calc_response_string (char *result, char *challenge) {
88 88
89 char zres[16]; 89 unsigned char zres[16];
90 int i; 90 int i;
91 91
92 av_md5_sum(zres, challenge, 64); 92 av_md5_sum(zres, challenge, 64);
93 93
94 /* convert zres to ascii string */ 94 /* convert zres to ascii string */
95 for (i=0; i<16; i++ ) { 95 for (i=0; i<16; i++ )
96 char a, b; 96 sprintf(result+i*2, "%02x", zres[i]);
97
98 a = (zres[i] >> 4) & 15;
99 b = zres[i] & 15;
100
101 result[i*2] = ((a<10) ? (a+48) : (a+87)) & 255;
102 result[i*2+1] = ((b<10) ? (b+48) : (b+87)) & 255;
103 }
104 } 97 }
105 98
106 static void real_calc_response_and_checksum (char *response, char *chksum, char *challenge) { 99 static void real_calc_response_and_checksum (char *response, char *chksum, char *challenge) {
107 100
108 int ch_len; 101 int ch_len;