Laravel Hash :: make的源文件

时间:2014-10-06 20:34:53

标签: php laravel hash password-protection

我无法找到Laravels的源文件“Hash:make();”功能

我准备在线申请,我是从头开始使用没有框架的。但首先我想用Laravels函数改变我的应用程序Hash密码的方式。

以后我可以将旧应用程序使用的数据库实现为使用Laravel构建的新数据库。

所以现在我只是担心一旦用Laravel应用程序实现密码,我就无法在数据库中散列/取消隐藏密码。这就是为什么我想从一开始就使用Laravels Hash,所以我以后不会遇到问题

1 个答案:

答案 0 :(得分:2)

它位于vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php

/**
 * Hash the given value.
 *
 * @param  string  $value
 * @param  array   $options
 * @return string
 *
 * @throws \RuntimeException
 */
public function make($value, array $options = array())
{
    $cost = isset($options['rounds']) ? $options['rounds'] : $this->rounds;

    $hash = password_hash($value, PASSWORD_BCRYPT, array('cost' => $cost));

    if ($hash === false)
    {
        throw new \RuntimeException("Bcrypt hashing not supported.");
    }

    return $hash;
}