Function __global->get_ratchet_cost

Definitions

sources/crypt.php

  • Given a bcrypt hash, get its cost.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: int

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$hash SHORT_TEXT No No required parameter N/A N/A The bcrypt hash

Returns

  • The cost (null: could not find / invalid bcrypt hash)
  • Type: ?integer
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Given a bcrypt hash, get its cost.
 *
 * @param  SHORT_TEXT $hash The bcrypt hash
 * @return ?integer The cost (null: could not find / invalid bcrypt hash)
 */

function get_ratchet_cost(string $hash) : ?int