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

 Methods

Constructor

__construct(array | \Traversable $options) 
Inherited

inherited_from \Zend\Crypt\Password\Bcrypt::__construct()

Parameters

$options

array\Traversable

Exceptions

\Zend\Crypt\Password\Exception\InvalidArgumentException

BcryptSha

create(string $password) : string

Parameters

$password

string

Exceptions

\Zend\Crypt\Password\Exception\RuntimeException

Returns

string

Get the backward compatibility

getBackwardCompatibility() : bool
Inherited

inherited_from \Zend\Crypt\Password\Bcrypt::getBackwardCompatibility()

Returns

bool

Get the cost parameter

getCost() : string
Inherited

inherited_from \Zend\Crypt\Password\Bcrypt::getCost()

Returns

string

Get the salt value

getSalt() : string
Inherited

inherited_from \Zend\Crypt\Password\Bcrypt::getSalt()

Returns

string

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

setBackwardCompatibility(bool $value) : \Zend\Crypt\Password\Bcrypt
Inherited

inherited_from \Zend\Crypt\Password\Bcrypt::setBackwardCompatibility()

Parameters

$value

bool

Returns

Set the cost parameter

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

inherited_from \Zend\Crypt\Password\Bcrypt::setCost()

Parameters

$cost

intstring

Exceptions

\Zend\Crypt\Password\Exception\InvalidArgumentException

Returns

Set the salt value

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

inherited_from \Zend\Crypt\Password\Bcrypt::setSalt()

Parameters

$salt

string

Exceptions

\Zend\Crypt\Password\Exception\InvalidArgumentException

Returns

Verify if a password is correct against a hash value

verify(string $password, string $hash) : bool

Parameters

$password

string

$hash

string

Exceptions

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

Returns

bool

 Properties

 

<p>Changed from 14 to 10 to prevent possibile DOS attacks due to the high computational time</p>

$cost : string
Inherited

see \Zend\Crypt\Password\http://timoh6.github.io/2013/11/26/Aggressive-password-stretching.html
inherited_from \Zend\Crypt\Password\Bcrypt::$$cost
 

$salt

$salt : string
Inherited

inherited_from \Zend\Crypt\Password\Bcrypt::$$salt

 Constants

 

MIN_SALT_SIZE

MIN_SALT_SIZE 
Inherited

inherited_from \Zend\Crypt\Password\Bcrypt::MIN_SALT_SIZE