I have a function that I am having a hard time understanding how the math is being performed:
unsigned long Fat_AuthAnswer(char b1, char b2, char b3, char b4)`
{
unsigned char* ptr = NULL;
unsigned short StartCRC = b1 + b2*256;
unsigned long ret = crcbuf(StartCRC, b3, &AuthBlock[b4]);
ret = (ret & 0x0000ffff) | (crcbuf(StartCRC, b4, &AuthBlock[b3])<<16);
}
With b1=0xAF b2=0x50
When the function is executed StartCRC = b1 + b2*256; Yields StartCRC = 0x4FAF
I would have expected the results for StartCRC to be 0x50AF.
My question is why does it seem that b2 is reduced by one?
Any help would be appreciated. Thanks
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…