使用密钥将密码编码到MD5

Omu*_*Omu 2 .net c# hash

目前我这样做:

    public static class Crypto
    {
        public static string Encode(string original)
        {
            var md5 = new MD5CryptoServiceProvider();
            var originalBytes = Encoding.Default.GetBytes(original);
            var encodedBytes = md5.ComputeHash(originalBytes);

            return BitConverter.ToString(encodedBytes);
        }
    }
Run Code Online (Sandbox Code Playgroud)

我听说我应该使用一些键来编码.我是不是该?这需要吗?这该怎么做?


我最终做了这个http://encrypto.codeplex.com/(sha1managed + random salt)

sle*_*led 6

您所谈论的内容称为"salt",这是一系列随机数据,您将其附加到原始纯文本字符串.这通常用于密码,防止彩虹表/字典攻击.

阅读:http://en.wikipedia.org/wiki/Salt_%28cryptography%29

对于C#,有一篇很好的文章:http://www.aspheute.com/english/20040105.asp