!/usr/bin/python
import hashlib import os def md5(file_path): if os.path.isdir(file_path): return '1' read_file = open(file_path,'r') the_hash = hashlib.md5() for line in read_file.readlines(): the_hash.update(line.encode('utf8')) read_file.close() return the_hash.hexdigest()