PHP Class Bcrypt

Show file Open project: bcosca/fatfree-core Class Usage Examples

Public Methods

Method Description
hash ( $pw, $salt = NULL, $cost = self::COST ) : string | FALSE Generate bcrypt hash of string
needs_rehash ( $hash, $cost = self::COST ) : boolean Check if password is still strong enough
verify ( $pw, $hash ) : boolean Verify password against hash using timing attack resistant approach

Method Details

hash() public method

Generate bcrypt hash of string
public hash ( $pw, $salt = NULL, $cost = self::COST ) : string | FALSE
$pw string
$salt string
$cost int
return string | FALSE

needs_rehash() public method

Check if password is still strong enough
public needs_rehash ( $hash, $cost = self::COST ) : boolean
$hash string
$cost int
return boolean

verify() public method

Verify password against hash using timing attack resistant approach
public verify ( $pw, $hash ) : boolean
$pw string
$hash string
return boolean