Browse Source

Improve efficiency of file cache lookup

nosoop 10 months ago
parent
commit
a7784d549c
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/smgdc/validate.py

+ 1 - 1
src/smgdc/validate.py

@@ -57,7 +57,7 @@ class BaseBinary:
         self.path = path
         self._file = open(self.path, "rb")
 
-        file_hash = hashlib.sha256(self.path.read_bytes())
+        file_hash = hashlib.file_digest(self._file, "sha256")
         cached_proj = (cache_path or pathlib.Path()) / f"{file_hash.hexdigest()}.angr.pkl"
         if not cached_proj.exists():
             self.angr = angr.Project(self.path, load_options={"auto_load_libs": False})