class BcryptHasher implements Hasher

Properties

protected int $rounds

Default crypt cost factor.

Methods

string
make(string $value, array $options = [])

Hash the given value.

bool
check(string $value, string $hashedValue, array $options = [])

Check the given plain value against a hash.

bool
needsRehash(string $hashedValue, array $options = [])

Check if the given hash has been hashed using the given options.

$this
setRounds(int $rounds)

Set the default password work factor.

int
cost(array $options = [])

Extract the cost value from the options array.

Details

at line 26
string make(string $value, array $options = [])

Hash the given value.

Parameters

string $value
array $options

Return Value

string

Exceptions

RuntimeException

at line 47
bool check(string $value, string $hashedValue, array $options = [])

Check the given plain value against a hash.

Parameters

string $value
string $hashedValue
array $options

Return Value

bool

at line 63
bool needsRehash(string $hashedValue, array $options = [])

Check if the given hash has been hashed using the given options.

Parameters

string $hashedValue
array $options

Return Value

bool

at line 76
$this setRounds(int $rounds)

Set the default password work factor.

Parameters

int $rounds

Return Value

$this

at line 89
protected int cost(array $options = [])

Extract the cost value from the options array.

Parameters

array $options

Return Value

int