为什么在.NET框架中没有托管MD5实现? [英] Why is there no managed MD5 implementation in the .NET framework?
问题描述
(重写问题,请参阅原始纪录)
问题在标题中。
为什么.NET框架中没有托管MD5实现?
特别是谈论一个纯代码实现的MD5算法,它不存在于.NET框架中。
在System.Security .Cryptography命名空间,我知道 MD5 抽象基类(必须继承,不能使用),我也知道 MD5CryptoServiceProvider 和
由于我没有设计框架,我不能肯定地说,但我相信他们可能没有打扰,为了安全的原因,以阻止其使用。 p>
我最初认为非托管实现会更快,但我们现在知道不是这样,请参见: http://stackoverflow.com/a/14850676/58391
我的下一个最佳猜测与Pavel在评论。与.NET和C#中的大多数功能一样,当底层非托管版本已经足够好时,可能只是没有足够的实施,测试和运送功能的成本。
这是很有趣的,看到一个真正的答案,虽然从设计语言的人。
(Re-written question, please see history for original).
The question is right there in the title.
Why is there no managed MD5 implementation in the .NET framework?
I'm specifically talking about a purely managed code implementation of the MD5 algorithm, which does not exist within the .NET framework.
Within the System.Security.Cryptography namespace, I am aware of the MD5 abstract base class (which has to be inherited and can't be used as is), and I'm also aware of MD5CryptoServiceProvider and MD5CNG which both provide implementations from the OS's underlying CSP (Crypto Service Provider) and CNG (Cryptography Next Generation) providers respectively, however, both of these implementations are unmanaged code.
UPDATE ON ANSWERS:
I appreciate that, whilst there should be "one true answer" to this question, we (the SO community) may not know it unless a Microsoft framework designer (or someone who knows one directly) is part of this community, however, many people have offered very reasonable "educated guesses" as to the thinking that went into omitting a managed MD5 implementation from the framework, however, I'm still curious to know if anyone does know the "real" answer to this question.
Since I didn't design the framework, I can't say for sure, but I believe they probably didn't bother in order to discourage its use for security reasons.
I had originally believed that the unmanaged implementation would be faster, but we now know that is not the case, see: http://stackoverflow.com/a/14850676/58391
My next best guess aligns with what Pavel says in the comments above. As with most features in .NET and C#, there probably just wasn't enough benefit over cost to implement, test, and ship the feature when the underlying unmanaged one was already good enough.
It would be interesting to see a real answer though from someone who designed the language.
这篇关于为什么在.NET框架中没有托管MD5实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!