超级版主
注册日期: 04-03
帖子: 18592
精华: 36
现金: 249466 标准币
资产: 1080358888 标准币
|
加密与解密日志
inline void CRC32Compute(PDWORD pdwCRC, PVOID pvData, DWORD dwSize)
{
__asm
{
xor eax, eax // eax = trash register
mov ebx, [pdwCRC] // ebx = crc value memory address
push ebx // backup crc value memory address
mov ebx, [ebx] // get crc value from memory
mov ecx, [dwSize] // ecx = byte counter
mov edx, [pvData] // edx = data pointer
j1: mov al, [edx] // grab next data byte
xor al, bl // xor data byte with crc byte
shr ebx, 8 // move out 1 byte of crc
xor ebx, [dwCRCTable + eax * 4] // xor crc with value in table
inc edx // increase data pointer
dec ecx // decrease byte counter
jnz j1 // if more bytes do it again
pop eax // get crc value memory address
mov [eax], ebx // put crc value in memory
}
}
此帖于 2009-12-09 02:09 PM 被 huangyhg 编辑.
|