# app/libPassword.inc

The Legend of Z

## Classes

Password | Class to ensure that Compatibility library below is loaded.

Package
  \Default
See also
  https://bitbucket.org/coderkun/the-legend-of-z

## Tags

author | Oliver Hanraths oliver.hanraths@uni-duesseldorf.de
copyright | 2014 Heinrich-Heine-Universität Düsseldorf
license | http://www.gnu.org/licenses/gpl.html

## Constants

### PASSWORD_BCRYPT

    PASSWORD_BCRYPT

#

File
  app/lib/Password.inc

## Tags

package | Default

### PASSWORD_DEFAULT

    PASSWORD_DEFAULT

#

File
  app/lib/Password.inc

## Tags

package | Default

## Functions

### password_hash()

    password_hash(string  $password, integer  $algo, array  $options = array()) : string|false

Hash the password using the specified algorithm

#### Parameters

string | $password | The password to hash
integer | $algo | The algorithm to use (Defined by PASSWORD_* constants)
array | $options | The options for the algorithm to use

#### Returns

string|false —

The hashed password, or false on error.

#

File
  app/lib/Password.inc

## Tags

package | Default

### password_get_info()

    password_get_info(string  $hash) : array

Get information about the password hash. Returns an array of the information that was used to generate the password hash.

array( 'algo' => 1, 'algoName' => 'bcrypt', 'options' => array( 'cost' => 10, ), )

#### Parameters

string | $hash | The password hash to extract info from

#### Returns

array —

The array of information about the hash.

#

File
  app/lib/Password.inc

## Tags

package | Default

### password_needs_rehash()

    password_needs_rehash(string  $hash, integer  $algo, array  $options = array()) : boolean

Determine if the password hash needs to be rehashed according to the options provided

If the answer is true, after validating the password using password_verify, rehash it.

#### Parameters

string | $hash | The hash to test
integer | $algo | The algorithm used for new password hashes
array | $options | The options array passed to password_hash

#### Returns

boolean —

True if the password needs to be rehashed.

#

File
  app/lib/Password.inc

## Tags

package | Default

### password_verify()

    password_verify(string  $password, string  $hash) : boolean

Verify a password against a hash using a timing attack resistant approach

#### Parameters

string | $password | The password to verify
string | $hash | The hash to verify against

#### Returns

boolean —

If the password matches the hash

#

File
  app/lib/Password.inc

## Tags

package | Default

###