Created
November 1, 2018 09:15
-
-
Save luxuia/c02a2519e3bf17e6261604db03d55fea to your computer and use it in GitHub Desktop.
计算obb hash的python方法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#coding: utf8 | |
import os | |
import sys | |
print(str(sys.argv)) | |
obb =sys.argv[1] | |
def md5(file): | |
import hashlib | |
md5_value = hashlib.md5() | |
with open(file, "rb") as file: | |
file_len = file.seek(0, 2) | |
file.seek(-min(file_len, 65558), 2) | |
data = file.read() | |
md5_value.update(data) | |
return md5_value.hexdigest() | |
print( md5(obb) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment