Skip to content

Can I programmatically calculate a hash of "public" parts of the dll? #2937

Answered by dgrunwald
safesparrow asked this question in Help
Discussion options

You must be logged in to vote

ILSpy uses System.Reflection.Metadata as the low-level assembly loader. This provides a read-only view into the .dll, no way to modify it.
At a higher level, ILSpy has its own type system (ICSharpCode.Decompiler.TypeSystem). This again is read-only.

If you want to modify a .dll, remove all method bodies and maybe the private methods, save it to a MemoryStream, and then hash it; then I would recommend using the Mono.Cecil library.

If you want the fastest assembly-API-hashing tool possible, and have some flexibility in what exactly you are hashing, then I would recommend using System.Reflection.Metadata with a custom "signature decoder" that directly adds to a hasher. Then, for public class…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by safesparrow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants