手机
当前位置:查字典教程网 >脚本专栏 >python >python求crc32值的方法
python求crc32值的方法
摘要:本文实例讲述了python求crc32值的方法。分享给大家供大家参考。具体实现方法如下:要想求CRC值,前面要importbinasciib...

本文实例讲述了python求crc32值的方法。分享给大家供大家参考。具体实现方法如下:

要想求CRC值,前面要import binascii

binascii.crc32(v) 求出了v的crc32值,这是一个long型,形如-1456387L,把这个值&0xffffffff得到的值形如48a213L的形式。

然后把这个值用16进制表示出来、

具体代码如下:

def _crc32(self, v): """ Generates the crc32 hash of the v. @return: str, the str value for the crc32 of the v """ return '0x%x' % (binascii.crc32(v) & 0xffffffff) #取crc32的八位数据 %x返回16进制

希望本文所述对大家的Python程序设计有所帮助。

【python求crc32值的方法】相关文章:

Python的函数嵌套的使用方法

Python完全新手教程

python脚本实现查找webshell的方法

python备份文件的脚本

python调用shell的方法

python去掉字符串中重复字符的方法

python连接sql server乱码的解决方法

python基础教程之类class定义使用方法

Python操作列表的常用方法分享

python生成器的使用方法

精品推荐
分类导航