master

laravel/framework

Last updated at: 29/12/2023 09:21

Hasher.php

TLDR

This file defines an interface for a hasher class that provides methods for hashing and checking values.

Methods (if applicable)

info

This method retrieves information about a hashed value. It takes a hashed value as a parameter and returns an array with information about the value.

make

This method hashes a given value. It takes a string value and an array of options (optional) and returns the hashed value as a string.

check

This method checks if a plain value matches a hashed value. It takes a plain value, a hashed value, and an array of options (optional) and returns a boolean indicating whether the value matches the hash.

needsRehash

This method checks if a hashed value needs to be rehashed using the given options. It takes a hashed value and an array of options (optional) and returns a boolean indicating whether the value needs to be rehashed.

Classes (if applicable)

<?php

namespace Illuminate\Contracts\Hashing;

interface Hasher
{
    /**
     * Get information about the given hashed value.
     *
     * @param  string  $hashedValue
     * @return array
     */
    public function info($hashedValue);

    /**
     * Hash the given value.
     *
     * @param  string  $value
     * @param  array  $options
     * @return string
     */
    public function make($value, array $options = []);

    /**
     * Check the given plain value against a hash.
     *
     * @param  string  $value
     * @param  string  $hashedValue
     * @param  array  $options
     * @return bool
     */
    public function check($value, $hashedValue, array $options = []);

    /**
     * Check if the given hash has been hashed using the given options.
     *
     * @param  string  $hashedValue
     * @param  array  $options
     * @return bool
     */
    public function needsRehash($hashedValue, array $options = []);
}