1.对网络传输的数据进行CRC32校验。
1 #include <stdint.h> 2 #include <stdio.h> 3 #include <string.h> 4 5 static const uint32_t crc32tab[] = { 6 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 7 0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 8 0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L, 9 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 0x90bf1d91L, 10 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, 11 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 12 0x136c9856L, 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 13 0x14015c4fL, 0x63066cd9L, 0xfa0f3d63L, 0x8d080df5L, 14 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, 0xa2677172L, 15 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, 16 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 17 0x32d86ce3L, 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 18 0x26d930acL, 0x51de003aL, 0xc8d75180L, 0xbfd06116L, 19 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, 0xb8bda50fL, 20 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, 21 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 22 0x76dc4190L, 0x01db7106L, 0x98d220bcL, 0xefd5102aL