为什么在.NET框架中没有托管MD5实现? [英] Why is there no managed MD5 implementation in the .NET framework?

查看:190
本文介绍了为什么在.NET框架中没有托管MD5实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(重写问题,请参阅原始纪录)



问题在标题中。



为什么.NET框架中没有托管MD5实现?



特别是谈论一个纯代码实现的MD5算法,它不存在于.NET框架中。



在System.Security .Cryptography命名空间,我知道 MD5 抽象基类(必须继承,不能使用),我也知道 MD5CryptoServiceProvider MD5CNG ,它们都分别提供来自操作系统的底层CSP(加密服务提供程序)和CNG(加密下一代)提供程序的实现,但是这两种实现都是非托管代码

一个真正的答案,这个问题,我们(SO社区)可能不知道,除非一个微软框架设计师(或直接知道一个人)是这个社区的一部分,然而,许多人提供了非常合理的有教育的猜测但是,我仍然想知道是否有人知道这个问题的真实答案。

解决方案

由于我没有设计框架,我不能肯定地说,但我相信他们可能没有打扰,为了安全的原因,以阻止其使用。 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆