1. #include<iostream>
  2. # include <stdio.h>
  3. # include <string.h>
  4. typedef unsigned int uint ;
  5. uint POLYNOMIAL = 0xEDB88320 ;
  6. int have_table = 0 ;
  7. uint table[256] ;
  8. void make_table()
  9. {
  10. int i, j, crc ;
  11. have_table = 1 ;
  12. for (i = 0 ; i < 256 ; i++)
  13. for (j = 0, table[i] = i ; j < 8 ; j++)
  14. table[i] = (table[i]>>1)^((table[i]&1)?POLYNOMIAL:0) ;
  15. }
  16. uint crc32(uint crc, char *buff, int len)
  17. {
  18. if (!have_table) make_table() ;
  19. crc = ~crc;
  20. for (int i = 0; i < len; i++)
  21. crc = (crc >> 8) ^ table[(crc ^ buff[i]) & 0xff];
  22. return ~crc;
  23. }
  24. int main ()
  25. {
  26. char s[] = "676547657567";
  27. printf("%08Xh\n", crc32(0, s, strlen(s)));
  28. system("pause");
  29. return 0 ;
  30. }

最新文章

  1. 洛谷P1328 生活大爆炸版石头剪刀布——S.B.S.
  2. curl上传图片文件
  3. OpenSUSE 开启SSH 和网络设置
  4. 【zz】matlab 直方图匹配
  5. [转]const 与 readonly知多少
  6. Spring 注释 @Autowired 和@Resource
  7. WiFi基本知识
  8. protected(C# 参考)
  9. list、set、map的特点
  10. 手动启动angular
  11. C#显示声名接口就是为了解决方法重名的问题
  12. wamp mysql 创建主从数据库
  13. Tuxedo入门学�
  14. 【SoDiaoEditor更新啦】--谨以献给那些还在医疗行业奋斗的小伙伴们
  15. Python查找指定文件
  16. Loadrunner回放https脚本时出现错误Error -27780 Connection reset by peer解决办法
  17. 内网主机使用yum安装软件
  18. vs2017 编译vue 错误 TS2307 Build:找不到模块“webpack”。
  19. [leetcode]19. Remove Nth Node From End of List删除链表倒数第N个节点
  20. TCP template 代码

热门文章

  1. ubuntu修改时间为北京时间
  2. 小记---------有关hadoop的HDFS命令行操作
  3. sqlserver迁移mysql语法修改
  4. C++中的new/delete、构造/析构函数、dynamic_cast分析
  5. ubuntu 安装 Gurobi 的tips
  6. 初识JavaScript(三)
  7. 链接Caffe,程序报错应用程序无法正常启动(0xc000007b)
  8. java实现spark常用算子之collect
  9. mysql在docker下运行,出现中文乱码
  10. vue的v-model指令原理分析