我刚刚浏览了DavidHayden关于哈希用户密码的文章之一.
真的,我无法得到他想要实现的目标.
这是他的代码:
private static string CreateSalt(int size)
{
//Generate a cryptographic random number.
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
byte[] buff = new byte[size];
rng.GetBytes(buff);
// Return a Base64 string representation of the random number.
return Convert.ToBase64String(buff);
}
private static string CreatePasswordHash(string pwd, string salt)
{
string saltAndPwd = String.Concat(pwd, salt);
string hashedPwd =
FormsAuthentication.HashPasswordForStoringInConfigFile(
saltAndPwd, "sha1");
return hashedPwd;
}
Run Code Online (Sandbox Code Playgroud)
有没有其他C#方法来散列密码并添加盐?
我在我的网站上实现用户帐户.我需要加密来自新成员的密码,但是我已经发现了许多可以实现这一目标的选项.
对称和非对称密码系统,公钥与私钥,数字签名,哈希算法,RSA,DES,Rijndael,PGP,MD5,SHA-1,https,安全套接字,Camellia,IDEA; 这是什么意思呢?
我甚至不知道MD5和rinjdael之间的区别,有人能告诉我加密的最佳选择吗?
我在C#中执行包含密码的命令行,如果我在windows任务管理器("进程"选项卡)中显示可选的"命令行"列,它包含所有参数,包括密码,你能想到隐藏这个的方法吗? ,只显示".exe"文件或什么?
谢谢