public: use standard uint32_t in place of dword

This commit is contained in:
Alibek Omarov 2023-06-13 06:49:59 +03:00
parent 93ee5b9446
commit 996897e30e
2 changed files with 12 additions and 13 deletions

View File

@ -22,7 +22,7 @@ GNU General Public License for more details.
#define CRC32_INIT_VALUE 0xFFFFFFFFUL
#define CRC32_XOR_VALUE 0xFFFFFFFFUL
static const dword crc32table[NUM_BYTES] =
static const uint32_t crc32table[NUM_BYTES] =
{
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
@ -90,26 +90,26 @@ static const dword crc32table[NUM_BYTES] =
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
void GAME_EXPORT CRC32_Init( dword *pulCRC )
void GAME_EXPORT CRC32_Init( uint32_t *pulCRC )
{
*pulCRC = CRC32_INIT_VALUE;
}
dword GAME_EXPORT CRC32_Final( dword pulCRC )
uint32_t GAME_EXPORT CRC32_Final( uint32_t pulCRC )
{
return pulCRC ^ CRC32_XOR_VALUE;
}
void GAME_EXPORT CRC32_ProcessByte( dword *pulCRC, byte ch )
void GAME_EXPORT CRC32_ProcessByte( uint32_t *pulCRC, byte ch )
{
dword ulCrc = *pulCRC;
uint32_t ulCrc = *pulCRC;
*pulCRC = crc32table[((byte)ulCrc ^ ch)] ^ (ulCrc >> 8);
}
void GAME_EXPORT CRC32_ProcessBuffer( dword *pulCRC, const void *pBuffer, int nBuffer )
void GAME_EXPORT CRC32_ProcessBuffer( uint32_t *pulCRC, const void *pBuffer, int nBuffer )
{
dword ulCrc = *pulCRC, tmp;
uint32_t ulCrc = *pulCRC, tmp;
byte *pb = (byte *)pBuffer;
while( nBuffer >= sizeof( uint64_t ))
@ -159,7 +159,7 @@ For proxy protecting
*/
byte CRC32_BlockSequence( byte *base, int length, int sequence )
{
dword CRC;
uint32_t CRC;
char *ptr;
char buffer[64];

View File

@ -26,12 +26,11 @@ typedef struct
uint in[16];
} MD5Context_t;
void CRC32_Init( dword *pulCRC );
void CRC32_Init( uint32_t *pulCRC );
byte CRC32_BlockSequence( byte *base, int length, int sequence );
void CRC32_ProcessBuffer( dword *pulCRC, const void *pBuffer, int nBuffer );
void CRC32_ProcessByte( dword *pulCRC, byte ch );
dword CRC32_Final( dword pulCRC );
void CRC32_ProcessBuffer( uint32_t *pulCRC, const void *pBuffer, int nBuffer );
void CRC32_ProcessByte( uint32_t *pulCRC, byte ch );
uint32_t CRC32_Final( uint32_t pulCRC );
void MD5Init( MD5Context_t *ctx );
void MD5Update( MD5Context_t *ctx, const byte *buf, uint len );
void MD5Final( byte digest[16], MD5Context_t *ctx );