-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathSVPlayerHash.py
More file actions
41 lines (32 loc) · 901 Bytes
/
SVPlayerHash.py
File metadata and controls
41 lines (32 loc) · 901 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
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
'''
Created on Jan 20, 2014
@author: magic282
https://docs.google.com/document/d/1w5MCBO61rKQ6hI5m9laJLWse__yTYdRugpVyz4RzrmM/preview
'''
import os
import hashlib
class SVPlayerHash(object):
'''
classdocs
'''
@staticmethod
def ComputeFileHash(fileName):
ret = ""
try:
vfile = open(fileName, "rb")
except IOError:
print("Cannot read file %s" % fileName)
statinfo = os.stat(fileName)
fLength = statinfo.st_size
ret = []
for i in (4096, int(fLength/3)*2, int(fLength/3), fLength-8192):
vfile.seek(i, 0)
bBuf = vfile.read(4096)
ret.append(hashlib.md5(bBuf).hexdigest())
vfile.close()
return ';'.join(ret)
def __init__(self, params):
'''
Constructor
'''