我正在尋找加密密碼字段以用於登錄系統,因此我想匹配加密以確保用戶輸入了正確的詳細信息。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