mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 22:32:21 +03:00
util md5 added
This commit is contained in:
parent
b4cfe8323c
commit
6180d6ff95
1 changed files with 9 additions and 1 deletions
|
@ -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())
|
||||||
|
|
Loading…
Reference in a new issue