我正在寻找加密密码字段以用于登录系统,因此我想匹配加密以确保用户输入了正确的详细信息。MD5或Silverlight中的其他加密C#
由于某些原因,Security.Cryptography在Silverlight中没有MD5服务,因此我正在寻找其他方法。
我以前用这个:
public string Md5Encrypt(string originalPassword)
{
//Declarations
Byte[] originalBytes;
Byte[] encodedBytes;
MD5 md5;
//Instantiate MD5CryptoServiceProvider, get bytes for original password and compute hash (encoded password)
md5 = new MD5CryptoServiceProvider();
originalBytes = ASCIIEncoding.Default.GetBytes(originalPassword);
encodedBytes = md5.ComputeHash(originalBytes);
//Convert encoded bytes back to a 'readable' string
return BitConverter.ToString(encodedBytes);
}
但现在无法正常工作。
谁能给我在Silverlight C#工作加密方法的简单例子
感谢
[MD5已被破坏](http://www.codeproject.com/KB/security/HackingMd5.aspx)。它不是**加密方法。这是一个哈希算法。与MD5类似,[也应避免使用SHA1](http://www.schneier.com/blog/archives/2005/02/sha1_broken.html)。 – pickypg 2011-04-17 18:09:45