Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using hashing to safely store user passwords

Tags:

php

passwords

Please try to search StackOverflow before asking a question. Many questions are already answered. For example:

  • PHP & MySQL compare password
  • how do I create a mySQL user with hash(‘sha256’, $salt . $password)?
  • Secure hash and salt for PHP passwords
  • User Login with a single query and per-user password salt
  • Non-random salt for password hashes

Hi

I want that nobody can see my password even in database..

So i used hash function like this

$passowrd_hash=hash('shal',$_POST['password']);

Now easily I can store this password_hash value into database. It will be something like in encrypted form.

Now user know its original password he don't know this encrypted password.

Now if he try to login through this original password..He is not able to login.

So is there any method so that it can be decrypted and user can make log in. So he can achieve both security of password as well as login again.

How to do this?

like image 794
Deepak Narwal Avatar asked Dec 04 '22 13:12

Deepak Narwal


1 Answers

you need to hash the user input password and compare hashes.

like image 178
John Boker Avatar answered Dec 06 '22 03:12

John Boker