1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-11 04:01:31 +00:00

Simplify/cleanup of real_calc_response_and_checksum()

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25750 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
rtogni 2008-01-13 21:21:25 +00:00
parent 9dbdee1bcc
commit ed48f1d58d

View File

@ -90,12 +90,7 @@ static void real_calc_response_and_checksum (char *response, char *chksum, char
int i;
unsigned char zres[16], buf[64];
/* initialize return values */
memset(response, 0, 41);
memset(chksum, 0, 9);
/* initialize buffer */
memset(buf, 0, 64);
AV_WB32(buf, 0xa1e9149d);
AV_WB32(buf+4, 0x0e6b3b59);
@ -105,14 +100,12 @@ static void real_calc_response_and_checksum (char *response, char *chksum, char
ch_len = strlen (challenge);
if (ch_len == 40) /* what a hack... */
{
challenge[32]=0;
ch_len=32;
}
if ( ch_len > 56 ) ch_len=56;
/* copy challenge to buf */
memcpy(buf+8, challenge, ch_len);
memset(buf+8+ch_len, 0, 56-ch_len);
}
/* xor challenge bytewise with xor_table */
@ -131,6 +124,7 @@ static void real_calc_response_and_checksum (char *response, char *chksum, char
/* calculate checksum */
for (i=0; i<8; i++)
chksum[i] = response[i*4];
chksum[8] = 0;
}