Repository navigation
feat: implement stable gimphash calculation - #103
Open
Kudwa-Abhishek wants to merge 2 commits into
Open
Kudwa-Abhishek wants to merge 2 commits into
Kudwa-Abhishek wants to merge 2 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
Hi maintainers, the Google CLA check has now passed. Thanks for your time! Whenever you get a chance, could you please review the PR? Happy to make any changes needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Gimphash calculation for Go binaries as requested in #16.
The implementation derives the hash from function names recovered from the binary's PCLN table and applies filtering and normalization intended to reduce noise from Go-generated and standard-library functions.
What changed
Added
calculateGimphash()ingimphash.go.Calculate Gimphash from the parsed PCLN function table.
Exclude compiler-generated symbols beginning with:
go.go:type.type:Normalize vendored function paths by removing the prefix through the last
vendor/.Exclude functions belonging to
internal/packages.Exclude functions belonging to packages recognized by GoReSym's existing standard-library package list.
Sort the remaining function names before hashing so that function ordering does not affect the result.
Generate the final hash using SHA-256 over the concatenated normalized function names.
Add the calculated Gimphash to GoReSym's metadata and human-readable output.
Add unit tests covering:
Motivation
Gimphash is useful for identifying and comparing Go binaries based on their function composition.
The implementation builds on GoReSym's existing PCLN parsing and standard-library package identification rather than maintaining a separate hard-coded list of standard-library packages. Sorting the selected function names also avoids making the resulting hash dependent on their ordering in the PCLN table.
Testing
The focused Gimphash test passes:
go test -run TestCalculateGimphashThe project also builds successfully with:
go buildRelated issue
Closes #16