def _check_hash(target_hash_file, **options):
 source_hash_file = _get_hash_file_path(target_hash_file)
 with open(target_hash_file) as f:
  target_hash_content = hashlib.sha1(f.read().encode('utf8')).hexdigest()
 if os.path.exists(source_hash_file):
  with open(source_hash_file) as f:
   source_hash_content = f.read().strip()
 else:
  source_hash_content = None
 with open(source_hash_file, 'w') as f:
  f.write(target_hash_content)
 return (source_hash_content == target_hash_content)

def _check_hash ( target_hash_file , ** options ) : source_hash_file = _get_hash_file_path ( target_hash_file ) with open ( target_hash_file ) as f : target_hash_content = hashlib . sha1 ( f . read ( ) . encode ( 'utf8' ) ) . hexdigest ( ) if os . path . exists ( source_hash_file ) : with open ( source_hash_file ) as f : source_hash_content = f . read ( ) . strip ( ) else : source_hash_content = None with open ( source_hash_file , 'w' ) as f : f . write ( target_hash_content ) return ( source_hash_content == target_hash_content )
this function has a side effect of creating a new hash file or updating the old hash file .