0

I'm using Tank Auth for my website.

I've searched for a function that would check if user has entered a valid password, when he tries to update his profile.

I don't understand how to hash password from user input that would match one in database.

Here's my controllers code:

            $password = $this->input->post('password');
            $hasher = new PasswordHash(
                $this->config->item('phpass_hash_strength', 'tank_auth'),
                $this->config->item('phpass_hash_portable', 'tank_auth')
            );
            $hashed_password = $hasher->HashPassword($password);

$hashed_password gives me different hash each time

I dont think that i should enable phpass_hash_portable

Any advices?

user1587985
  • 665
  • 1
  • 6
  • 13

2 Answers2

2

You need to use the CheckPassword module of the Tank Auth instead of hashing it by using the PasswordHash of the phpass.

0

You can check your password by using this function:

$hasher->CheckPassword(password which has to be checked,password from database).

instead of encrypting yourself.

Note: password which has to be checked => is raw data password from database => password from database.

ronalchn
  • 12,225
  • 10
  • 51
  • 61