Skip to content

Conversation

@zackorndorff
Copy link
Contributor

We were previously hashing the BNDB itself if you saved a BNDB. Now, we cache the original hash in the database, and if it's not present, we hash the contents of the top-level BinaryView, which matches the contents of the original file (modulo any patches that have been applied).

We previously discussed the pseudocode of:

  1. Pull cached hash from BNDB
  2. Hash open(bv.file.original_filename).read()
  3. Hash contents of BNDB BinaryView

I'd think we should skip item 2), which is what this PR currently does. Logic is that if I've saved a DB I expect tooling to use the DB, rather than fishing around for files. But I can implement 2) if you want before merging, feel free to leave a PR comment to that effect :)

(We're already fishing around in the DB for cached metadata, so we're already in less-than-obvious-behavior territory, the question is what matches what the user means best.)

One other thing is that this PR now requires Python 3.7 (IIRC) to parse, as I'm using the walrus operator for readability. The earliest Binja release that supports Python3 supports 3.9, so that should be fine unless you're running some oddball Linux setup, of which I was probably the last ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant