Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Hash generating a different hash for same password

Hello, If i use

$password = '123456'; $this->security->hash($password);

I get a different hash everytime, i don't understand this...is this a bug?



62.7k
Accepted
answer

No, its intended. You have to use checkHash() method in order to compare passwords.

$this->security->checkHash($this->request->getPost('password'), $dbPasswordHere)


1.8k
edited Aug '16

I used checkHash() and it keeps sending false even wtih the right password

Edit : Ok problem solved, should use

$this->security->checkHash($this->request->getPost('password'), $dbPasswordHere) and not

$this->security->checkHash($dbPasswordHere, $this->request->getPost('password'))

Inverted the parameters thinking it doesn't matter..