Dcrypt\Hash::build PHP Метод

build() приватный статический Метод

Internal function used to build the actual hash.
private static build ( string $input, string $password, integer $cost, string | null $salt = null ) : string
$input string Data to hash
$password string Password to use in HMAC call
$cost integer Number of iterations to use
$salt string | null Initialization vector to use in HMAC calls
Результат string
    private static function build($input, $password, $cost, $salt = null)
    {
        // Generate salt if needed
        $salt = $salt === null ? Random::bytes(16) : $salt;
        // Verify and normalize cost value
        $cost = self::cost($cost);
        // Create key to use for hmac operations
        $key = \hash_hmac(self::ALGO, $salt, $password, true);
        // Perform hash iterations. Get a 32 byte output value
        $hash = self::ihmac($input, $key, $cost, self::ALGO);
        // Return the salt + cost blob + hmac
        return $salt . self::costHash($cost, $salt, $password) . $hash;
    }