Piwik\Auth\

Password

Main class to handle actions related to password hashing and verification.

Methods

The class defines the following methods:

  • hash() — Hashes a password with the configured algorithm.
  • info() — Returns information about a hashed password (algo, options, .
  • needsRehash() — Rehashes a user's password if necessary.
  • verify() — Verifies a user's password against the provided hash.

hash()

Hashes a password with the configured algorithm.

Signature

  • It accepts the following parameter(s):

    • $password (string) —
  • It returns a string value.

info()

Returns information about a hashed password (algo, options, .

..).

Can be used to verify whether a string is compatible with password_hash().

Signature

  • It accepts the following parameter(s):

    • $hash (string) —
  • It returns a array value.

needsRehash()

Rehashes a user's password if necessary.

This method expects the password to be pre-hashed by \Piwik\Plugins\UsersManager\UsersManager::getPasswordHash().

Signature

  • It accepts the following parameter(s):

    • $hash (string) —
  • It returns a boolean value.

verify()

Verifies a user's password against the provided hash.

This method expects the password to be pre-hashed by \Piwik\Plugins\UsersManager\UsersManager::getPasswordHash().

Signature

  • It accepts the following parameter(s):

    • $password (string) —

    • $hash (string) —

  • It returns a boolean value.