1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-11 01:16:45 +00:00

Merge calc_response_string() into real_calc_response_and_checksum()

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22962 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
rtogni 2007-04-09 21:34:20 +00:00
parent 2213c30ac2
commit 350e6eef26

View File

@ -84,24 +84,13 @@ static void hexdump (const char *buf, int length) {
#endif #endif
static void calc_response_string (char *result, char *challenge) {
unsigned char zres[16];
int i;
av_md5_sum(zres, challenge, 64);
/* convert zres to ascii string */
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) { static void real_calc_response_and_checksum (char *response, char *chksum, char *challenge) {
int ch_len; int ch_len;
int i; int i;
char *ptr; char *ptr;
char buf[128]; char buf[128];
unsigned char zres[16];
/* initialize return values */ /* initialize return values */
memset(response, 0, 64); memset(response, 0, 64);
@ -135,7 +124,11 @@ static void real_calc_response_and_checksum (char *response, char *chksum, char
for (i=0; i<XOR_TABLE_SIZE; i++) for (i=0; i<XOR_TABLE_SIZE; i++)
ptr[i] = ptr[i] ^ xor_table[i]; ptr[i] = ptr[i] ^ xor_table[i];
calc_response_string (response, buf); av_md5_sum(zres, buf, 64);
/* convert zres to ascii string */
for (i=0; i<16; i++ )
sprintf(response+i*2, "%02x", zres[i]);
/* add tail */ /* add tail */
strcpy (&response[32], "01d0a8e3"); strcpy (&response[32], "01d0a8e3");