是一个好盐的GUID?是我的注册/登录过程中有任何缺陷? [英] is a GUID a good salt? is my register/login process got any flaw?

查看:103
本文介绍了是一个好盐的GUID?是我的注册/登录过程中有任何缺陷?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果数据库中的表格如下所示:

  userid uniqueidentifier 
username varchar(20)
密码varbinary(最大)

当用户提交(注册)时,我发送用户/到存储过程。

存储过程创建一个新的GUID(使用 NEWID())然后我使用 SQL Server的HashBytes (sha1)函数根据提供的GUID +密码创建密码,然后将值插入上面的表中。



当用户提交(登录)时,我将用户/密码发送到存储过程。



存储过程外观为用户名,并抓住用户ID来比较guid +密码的hashbyte(sha1)和密码字段。



你是否看到逻辑内的任何缺陷?

解决方案

这非常标准 - 对于盐来说,guid会很好。盐的要点是防止彩虹攻击,以及几乎任何随机的价值​​(甚至是如果不是随机的,那么至少,不同的)为每个用户将做的伎俩。


If my table inside the database look like:

 userid uniqueidentifier
 username varchar(20)
 password varbinary(max)

When the user submit(to register), I send the user/pass to a stored procedure.

The stored procedure create a new GUID(Using NEWID()) then I use the HashBytes(sha1) function of SQL Server to create the password based on the GUID+password provided then I insert the values into the table above.

When the user submit(to login), I send the user/pass to a stored procedure.

The stored procedure look for the username and grab the userid to compare the hashbyte(sha1) of guid+password with the password field.

do you see any flaw inside that logic?

解决方案

That's pretty standard - a guid would be fine for a salt. The point of a salt is to prevent Rainbow attacks, and pretty much any value that's random (or even if not random, then at the very least, different) for each user will do the trick.

这篇关于是一个好盐的GUID?是我的注册/登录过程中有任何缺陷?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆