def restore_check_hash(volume_info, vol_path): """Check the hash of vol_path path against data in volume_info""" global filename_tdp hash_pair = volume_info.get_best_hash() if hash_pair: calculated_hash = gpg.get_hash(hash_pair[0], vol_path) if calculated_hash != hash_pair[1]: log.Log("Invalid data - %s hash mismatch:\n" "Calculated hash: %s\n" "Manifest hash: %s\n" % (hash_pair[0], calculated_hash, hash_pair[1]), 1) return False return True
def restore_check_hash(volume_info, vol_path): """Check the hash of vol_path path against data in volume_info""" hash_pair = volume_info.get_best_hash() if hash_pair: calculated_hash = gpg.get_hash(hash_pair[0], vol_path) if calculated_hash != hash_pair[1]: debug_log( ("Invalid data - %s hash mismatch:\nCalculated hash: %s" + "\nManifest hash: %s\n") % (hash_pair[0], calculated_hash, hash_pair[1])) return False return True
def test_sha(self): hash = gpg.get_hash( u"SHA1", path.Path(u"testfiles/various_file_types/regular_file")) assert hash == u"886d722999862724e1e62d0ac51c468ee336ef8e", hash
def test_sha(self): hash = gpg.get_hash("SHA1", path.Path("testfiles/various_file_types/regular_file")) assert hash == "886d722999862724e1e62d0ac51c468ee336ef8e", hash
def test_sha(self): testhash = gpg.get_hash( u"SHA1", path.Path(u"{0}/testfiles/various_file_types/regular_file".format( _runtest_dir))) assert testhash == u"886d722999862724e1e62d0ac51c468ee336ef8e", testhash