You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While attempting to review and leverage the TypeRefHash, we came across a few issues we would like to bring up and hopefully resolve through discussion/implementation:
Could you explicitly state the sort order in the definition of TypeRefHash? It seems the sort order is the default C# sort order, which may cause some problems as stated in subsequent bullets:
Since the C# default sort order is leveraged, the generated TypeRefHash may change based upon locality/language. For example, if the default language setting for a user is French, the generated TypeRefHash may be different than if the default language setting is English.
The C# default sort order treats some characters differently than, say, Python. Having a sorter which is language agnostic will better enable portability and implementation in other languages/environments.
The sort order is case-insensitive, while the hash is case-sensitive. The TypeRefHash can be defeated by altering the case of some of the strings. In comparison, an ImportHash converts all names to lower-case before both comparing and hashing.
The text was updated successfully, but these errors were encountered:
Hi @ddash-ct the topic came up a few times already. It is definitely a design flaw that we haven't on our minds when we created the TRH.
As far as I can see, the best would be to bring out a TRH 2.0, with a defined sort order that is easy to port to other languages.
For the case argument, I'm not sure if that is an issue, as .NET TypeRefs are case-sensitive as well, e.g. System.Text.Json is not the same as system.Text.Json. In that case it differs from the PE import table. If I'm wrong on that, please let me know.
I'll discuss the problem with the co-creators of the hash. As it is a breaking change, we need some time to figure out how to do it without creating too much friction.
While attempting to review and leverage the
TypeRefHash
, we came across a few issues we would like to bring up and hopefully resolve through discussion/implementation:TypeRefHash
? It seems the sort order is the default C# sort order, which may cause some problems as stated in subsequent bullets:TypeRefHash
may change based upon locality/language. For example, if the default language setting for a user is French, the generatedTypeRefHash
may be different than if the default language setting is English.TypeRefHash
can be defeated by altering the case of some of the strings. In comparison, anImportHash
converts all names to lower-case before both comparing and hashing.The text was updated successfully, but these errors were encountered: