Skip to content

Commit

Permalink
Use sha256 for gef_hash to quiet static analyzers (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattadev committed Nov 16, 2021
1 parent 8fc0583 commit 721ad4b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -4737,7 +4737,7 @@ def do_invoke(self, argv):
gef_fpath = os.path.abspath(os.path.expanduser(inspect.stack()[0][1]))
gef_dir = os.path.dirname(gef_fpath)
with open(gef_fpath, "rb") as f:
gef_hash = hashlib.sha1(f.read()).hexdigest()
gef_hash = hashlib.sha256(f.read()).hexdigest()

if os.access("{}/.git".format(gef_dir), os.X_OK):
ver = subprocess.check_output("git log --format='%H' -n 1 HEAD", cwd=gef_dir, shell=True).decode("utf8").strip()
Expand All @@ -4747,7 +4747,7 @@ def do_invoke(self, argv):
gef_blob_hash = subprocess.check_output("git hash-object {}".format(gef_fpath), shell=True).decode().strip()
gef_print("GEF: (Standalone)")
gef_print("Blob Hash({}): {}".format(gef_fpath, gef_blob_hash))
gef_print("SHA1({}): {}".format(gef_fpath, gef_hash))
gef_print("SHA256({}): {}".format(gef_fpath, gef_hash))
gef_print("GDB: {}".format(gdb.VERSION, ))
py_ver = "{:d}.{:d}".format(sys.version_info.major, sys.version_info.minor)
gef_print("GDB-Python: {}".format(py_ver, ))
Expand Down

0 comments on commit 721ad4b

Please sign in to comment.