def md5_for_file(filename):
 try:
  md5 = hashlib.md5()
  for byte in readFileBuffered(filename):
   md5.update(byte)
  return md5.hexdigest()
 except Exception:
  return None

def md5_for_file ( filename ) : try : md5 = hashlib . md5 ( ) for byte in readFileBuffered ( filename ) : md5 . update ( byte ) return md5 . hexdigest ( ) except Exception : return None
generate an md5 hash for a file .