Jason
Jason

Reputation: 21

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. 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']);

Any idea why?

Upvotes: 2

Views: 3604

Answers (1)

Mark Baker
Mark Baker

Reputation: 212502

Double check the size of the password column on your database... ensure that it's holding the entire sha1 hash. (varchar(40))

When hashing the password, what is the value of the raw_output parameter? If true, then your return is a 20-character binary string; if false, it's a 40-character ASCII string. Ensure you can store a binary value on the database if the former, or change to using the latter.

Upvotes: 4

Related Questions