AssemblyAlgorithmIdAttribute
Why would you开发者_StackOverflow社区 care what algorithm the CLR uses to hash the files in your assembly? When would you use this attribute?
Hash algorithm could depend on the size of files / time required to get hash and picked during compilation time. I.e.:
- for small files one hash algorithm might perform faster
- for sparse files some other algorithm
- for large ones - third one etc... - evaluation of the most efficient hashing algorithm could be done once in order to decrease time spent on checks later (although its quite unlikely done in this way :) )
AssemblyAlgorithmIdAttribute also provides forward compatibility for future versions of hashing algorithms.
It could also depend on framework version - actual algorithm could've changed already since .net 1.1
May be if I am planning to read assembly from a non CLR program or in other words I am interested in manually reading the contents of assembly I can use the exact hash algorithm to decode the data contained in the assembly.
精彩评论