def CheckHashes(self, hashes):
    hash_map = {}
    for hsh in hashes:
      if hsh.HasField("sha256"):
        # The canonical name of the file is where we store the file hash.
        hash_map[aff4.ROOT_URN.Add("files/hash/generic/sha256").Add(
            str(hsh.sha256))] = hsh

    for metadata in aff4.FACTORY.Stat(list(hash_map), token=self.token):
      yield metadata["urn"], hash_map[metadata["urn"]]
Check hashes against the filestore.
dataset/ETHPy150Open google/grr/grr/lib/aff4_objects/filestore.py/HashFileStore.CheckHashes