util md5 added

This commit is contained in:
Volkan Şahin 2016-06-16 16:39:47 +03:00
parent b4cfe8323c
commit 6180d6ff95

View file

@ -9,7 +9,7 @@ import pwd
import shutil import shutil
import stat import stat
import subprocess import subprocess
import sys import hashlib
class Util: class Util:
@ -218,3 +218,11 @@ class Util:
return False return False
except Exception as e: except Exception as e:
return False return False
@staticmethod
def get_md5_file(fname):
hash_md5 = hashlib.md5()
with open(fname, 'rb') as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return str(hash_md5.hexdigest())