简体   繁体   English

sha1(密码)加密

[英]sha1(password) encryption

Alright, so I tried to make my users info super secure by adding " . sha1($_POST['password']) . " when inserting their password when they register. 好吧,所以我尝试通过在注册时插入密码时添加" . sha1($_POST['password']) . "来使用户的信息超级安全。 THAT WORKS great, looking at the database, I have no clue what their password is. 很好,查看数据库,我不知道他们的密码是什么。

Now the problem is logging in. I'm running some tests and when I try to log in, the password 12345 doesn't match the encrypted password using $password=sha1($_POST['mypassword']); 现在问题正在登录。我正在运行一些测试,当我尝试登录时,密码12345与使用$password=sha1($_POST['mypassword']);的加密密码不匹配$password=sha1($_POST['mypassword']);

Any idea why? 知道为什么吗?

Double check the size of the password column on your database... ensure that it's holding the entire sha1 hash. 仔细检查数据库上的password列的大小...确保它包含整个sha1哈希。 (varchar(40)) (VARCHAR(40))

When hashing the password, what is the value of the raw_output parameter? 在对密码进行哈希处理时,raw_output参数的值是什么? If true, then your return is a 20-character binary string; 如果为true,则返回的是20个字符的二进制字符串。 if false, it's a 40-character ASCII string. 如果为false,则为40个字符的ASCII字符串。 Ensure you can store a binary value on the database if the former, or change to using the latter. 确保您可以在数据库中存储二进制值(如果是前者),或者更改为使用后者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM