Bcrypt algorithm using crypt() function of PHP with password hashed using SHA2 to allow for passwords >72 characters.

package Default
inherited_from \Zend\Crypt\Password\Bcrypt

 Methods

Constructor

__construct(array|\Traversable $options = array()
Inherited

Parameters

$options

array\Traversable

Exceptions

\Zend\Crypt\Password\Exception\InvalidArgumentException

BcryptSha

create(string $password) : string
inherited_from \Zend\Crypt\Password\Bcrypt::create()

Parameters

$password

string

Exceptions

\Zend\Crypt\Password\Exception\RuntimeException

Returns

string

Bcrypt

create(string $password) : string
Inherited
inherited_from \Zend\Crypt\Password\PasswordInterface::create()

Parameters

$password

string

Exceptions

\Zend\Crypt\Password\Exception\RuntimeException

Returns

string

Get the backward compatibility

getBackwardCompatibility() : boolean
Inherited
deprecated since zf 2.3 requires PHP >= 5.3.23

Returns

boolean

Get the cost parameter

getCost() : string
Inherited

Returns

string

Get the salt value

getSalt() : string
Inherited

Returns

string

Set the backward compatibility $2a$ instead of $2y$ for PHP 5.3.7+

setBackwardCompatibility(boolean $value) : \Zend\Crypt\Password\Bcrypt
Inherited
deprecated since zf 2.3 requires PHP >= 5.3.23

Parameters

$value

boolean

Returns

\Zend\Crypt\Password\Bcrypt

Set the cost parameter

setCost(integer|string $cost) : \Zend\Crypt\Password\Bcrypt
Inherited

Parameters

$cost

integerstring

Exceptions

\Zend\Crypt\Password\Exception\InvalidArgumentException

Returns

\Zend\Crypt\Password\Bcrypt

Set the salt value

setSalt(string $salt) : \Zend\Crypt\Password\Bcrypt
Inherited

Parameters

$salt

string

Exceptions

\Zend\Crypt\Password\Exception\InvalidArgumentException

Returns

\Zend\Crypt\Password\Bcrypt

Verify if a password is correct against a hash value

verify(string $password, string $hash) : boolean
inherited_from \Zend\Crypt\Password\Bcrypt::verify()

Parameters

$password

string

$hash

string

Exceptions

\Zend\Crypt\Password\Exception\RuntimeException when the hash is unable to be processed

Returns

boolean

Verify if a password is correct against a hash value

verify(string $password, string $hash) : boolean
Inherited
inherited_from \Zend\Crypt\Password\PasswordInterface::verify()

Parameters

$password

string

$hash

string

Exceptions

\Zend\Crypt\Password\Exception\RuntimeException when the hash is unable to be processed

Returns

boolean

 Properties

 

Changed from 14 to 10 to prevent possibile DOS attacks due to the high computational time

$cost : string

Default

'10'
see
 

$salt

$salt : string

Default

 Constants

 

MIN_SALT_SIZE

MIN_SALT_SIZE = 16