开发者

AssemblyAlgorithmIdAttribute: Why would anyone use this?

开发者 https://www.devze.com 2023-03-14 09:18 出处:网络
AssemblyAlgorithmIdAttribute Why would you开发者_StackOverflow社区 care what algorithm the CLR uses to hash the files in your assembly? When would you use this attribute?

AssemblyAlgorithmIdAttribute

Why would you开发者_StackOverflow社区 care what algorithm the CLR uses to hash the files in your assembly? When would you use this attribute?


  1. 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 :) )
  2. AssemblyAlgorithmIdAttribute also provides forward compatibility for future versions of hashing algorithms.

  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消