1,利用python计算文件crc值
[python] view plaincopy
- def fileCRC32(file,crc32,buf):
- crc32^=0xffffffff
- for tmp in buf:
- crc32 = crc32_table[(crc32^ord(tmp))&0xff]^((crc32>>8)&0xffffff)
- return crc32^0xffffffff
[python] view plaincopy
- while True:
- tmp=frb.read(4*1024)
- if tmp==‘‘:
- break
- crc32 += fileCRC32(os.path.join(root,file),crc32,tmp)
时间: 2024-12-26 04:40:19