-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCRC32.py
More file actions
31 lines (26 loc) · 682 Bytes
/
CRC32.py
File metadata and controls
31 lines (26 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sys, os
import zlib
if sys.version_info[:2] < (3, 6):
print("The fxxx programmer is too lazy to check any support for Python 3.6-")
input("Press ENTER to exit...")
sys.exit(1)
file_list = sys.argv[1:]
result = open("result.txt", "w+")
result.close()
print("输入 {} 个文件".format(len(file_list)))
for f in file_list:
file = open(f, 'rb')
hash = 0
while True:
s = file.read(65536)
if not s:
break
hash = zlib.crc32(s, hash)
hash = "{:08X}".format(hash)
print(hash)
file.close()
result = open("result.txt", "a+")
result.write(hash)
result.write("\n")
result.close()
sys.exit(1)