我得database里面有两个密码,都是nvarchar类型,一个是password,另外一个passwordsalt.比如(
ku9R715tO4D68kZPPB+umqiLSaM=,NeTBuehQYFbJLe3BBZvLwg==),我用membership去看,显示是用SHA1来加密得。那我现在验证登陆用户得话。怎么实现啊?急s我了,请大家帮帮忙。万分感谢
ku9R715tO4D68kZPPB+umqiLSaM=,NeTBuehQYFbJLe3BBZvLwg==),我用membership去看,显示是用SHA1来加密得。那我现在验证登陆用户得话。怎么实现啊?急s我了,请大家帮帮忙。万分感谢
解决方案 »
- 有人用过.net + postgresql 做过网站吗?
- 禁止通过URL直接访问文件夹
- ASP.NET中用COM读取EXCEL时,如果已打开一个EXCEL文档则不能读取
- 请问如何对方法传递一组信息啊?100分求救
- 为什么简体网页下输入big5繁体字,在后台用this.quest.Form["txt1"]取到的是""或者是乱码?
- 智能客户的问题,无法访问web service
- 要想将FreetextBox粘贴时就去处word格式代码要怎样修改,高手给提点一下了。(第一次提问,不太董的给分,大家见谅了)
- datagrid使用中的两个问题,虔心求教!
- 急啊,我的.asp启动不了,IIs也启动不了
- 请教:如何在DataGrid中实现删除操作时,出现警告对话框,确定删除?
- 在页面的后台使用static变量的问题
- SQL SERVER装好后是交给美国公司使用,那么安装SQL SERVER的字符集和时区用什么?
select * from yourTable where yourUserName=@UserName and yourPwd = @Pwd//c# program
string strPwd = EncrytoData( yourInputValue );//Use "strPwd" to query database
我刚才也用了这个方法测试了一遍,生成得密码有40位,而数据库里普遍都只有28位
{
byte[] passwordBuf = System.Text.Encoding.Unicode.GetBytes(password);
byte[] saltBuf = Convert.FromBase64String(salt); byte[] buf = new byte[passwordBuf.Length + saltBuf.Length]; Buffer.BlockCopy(saltBuf, 0, buf, 0, saltBuf.Length);
Buffer.BlockCopy(passwordBuf, 0, buf, saltBuf.Length, passwordBuf.Length); HashAlgorithm hashAlgorithm = HashAlgorithm.Create(hashAlgorithmType);
buf = hashAlgorithm.ComputeHash(buf);
return Convert.ToBase64String(buf);
}
只要上面函数的三个参数是相同的,那么返回的加密码肯定是一致的
{
//用户登陆的操作
}else
{
}
你函数里传进来得salt是指什么
{
byte[] salt = new byte[saltLength];
(new System.Security.Cryptography.RNGCryptoServiceProvider()).GetBytes(salt);
return Convert.ToBase64String(salt);
}