Function __global->calculate_reasonable_ratchet
Definitions
sources/crypt.php
- Calculate a reasonable cryptographic ratchet based on the server's CPU speed.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: int
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $target_time | float | No | No | 0.1 | N/A | N/A | The ratchet should not exceed this amount of time in seconds when calculating |
| $minimum_cost | integer | No | No | 10 | N/A | N/A | The minimum allowed ratchet; must be between 10 and 31 |
Returns
- The suggested ratchet to use (null: password_hash is not supported)
- Type: ?integer
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Calculate a reasonable cryptographic ratchet based on the server's CPU speed.
*
* @param float $target_time The ratchet should not exceed this amount of time in seconds when calculating
* @param integer $minimum_cost The minimum allowed ratchet; must be between 10 and 31
* @return ?integer The suggested ratchet to use (null: password_hash is not supported)
*/
function calculate_reasonable_ratchet(float $target_time = 0.1, int $minimum_cost = 10) : ?int
* Calculate a reasonable cryptographic ratchet based on the server's CPU speed.
*
* @param float $target_time The ratchet should not exceed this amount of time in seconds when calculating
* @param integer $minimum_cost The minimum allowed ratchet; must be between 10 and 31
* @return ?integer The suggested ratchet to use (null: password_hash is not supported)
*/
function calculate_reasonable_ratchet(float $target_time = 0.1, int $minimum_cost = 10) : ?int

