📜  Python中的zlib.crc32()

📅  最后修改于: 2022-05-13 01:54:48.006000             🧑  作者: Mango

Python中的zlib.crc32()

借助zlib.crc32()方法,我们可以计算 crc32(循环冗余校验)对特定数据的校验和。它将通过使用zlib.crc32()方法给出 32 位整数值作为结果。

示例 #1:
在这个例子中,我们可以看到通过使用zlib.crc32()方法,我们能够使用这个方法计算给定数据的无符号 32 位校验和。

# import zlib and crc32
import zlib
  
s = b'I love python, Hello world'
# using zlib.crc32() method
t = zlib.crc32(s)
  
print(t)

输出 :

示例 #2:

# import zlib and crc32
import zlib
  
s = b'Hello GeeksForGeeks'
# using zlib.crc32() method
t = zlib.crc32(s)
  
print(t)

输出 :