Authentication 哪个散列函数是laravel';s Auth正在使用?

Authentication 哪个散列函数是laravel';s Auth正在使用?,authentication,hash,laravel-4,Authentication,Hash,Laravel 4,我试图使用Laravel的内置身份验证,但它不起作用。如果我在注册过程中散列密码,它与登录过程中的散列不匹配,因为Laravel的auth生成的散列与hash:make()完全不同 我做了一个测试路线和功能,让一切都清楚 (我尝试将Auth::trunt()函数与Hash::make()一起使用,而不使用Hash::make(),如果我传递散列密码,它将生成一个完全不同的密码,如果我传递原始密码,Auth甚至懒得对其进行散列): 第一部分将此行生成到my mysql服务器: 39test@mai

我试图使用Laravel的内置身份验证,但它不起作用。如果我在注册过程中散列密码,它与登录过程中的散列不匹配,因为Laravel的auth生成的散列与
hash:make()
完全不同

我做了一个测试路线和功能,让一切都清楚 (我尝试将Auth::trunt()函数与Hash::make()一起使用,而不使用Hash::make(),如果我传递散列密码,它将生成一个完全不同的密码,如果我传递原始密码,Auth甚至懒得对其进行散列):

第一部分将此行生成到my mysql服务器:

39test@mail.com, $2y$10$gkzQ2BEuDWN05RQ/OyBH8u4aKRqdL5zSIthUO4BUyEKcscgzRwZzG, valami ....etc
在尝试登录时,我故意将密码字段的名称错误地输入到jelszo1(英文中的password1),以获取sql错误

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'jelszo1' in 'where clause' (SQL: select * from `Felhasznalo` where `email` = 39test@mail.com and `jelszo1` = y$XAnnnGNKrOQOxBiX2BnEPOq86Y9mh5h./xwUlfCTPpzW.jzzt3YiO limit 1) 
第一部分(mysql中):

第二部分(尝试登录时):

和用户模型(名为Felhasznalo)

在尝试()中使用原始密码时发生SQL错误:


我刚刚检查了身份验证代码,您的密码列必须被称为
password
。您不能使用
jelszo

另外-您的R登录代码不正确。你只要这样做:

if (Auth::attempt(array(
                'email' => $email,
                'password' => $password
            ))) {
        echo 'Working';
    } else {
        echo 'Not working';
    }

Auth::trunt()将为您进行哈希运算。

可以在上找到文章标题(laravel的Auth使用哪个哈希函数?)中对您的问题的答案

以下是链接博文“如何?”部分的第一句话:

在内部,Hash::make()使用bcrypt函数和Blowfish算法进行加密

此外,你可以在屏幕上看到他们说:

Laravel哈希facade为存储用户密码提供了安全的Bcrypt哈希


我编辑了我的问题,但没有。如果我传入原始密码,它不会将其散列。检查最后一部分,是的。查看文档:-你的代码中出现了其他问题我知道应该这样做,但事实并非如此。A这是真的。非常感谢。但是,为什么getAuthPassword()函数要用于用户模型呢。这太愚蠢了。
$2y$10$gkzQ2BEuDWN05RQ/OyBH8u4aKRqdL5zSIthUO4BUyEKcscgzRwZzG
y$XAnnnGNKrOQOxBiX2BnEPOq86Y9mh5h./xwUlfCTPpzW.jzzt3YiO
<?php

use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;

class Felhasznalo extends \Eloquent implements UserInterface, RemindableInterface {

    use UserTrait,
        RemindableTrait;

    protected $fillable = [
        'id', 'email', 'jelszo', 'teljesnev', 'jelszoreset',
        'hash', 'aktiv', 'ban', 'FelFelhasznaloiSzint_id',
        'remember_token'
    ];
    protected $guarded = [
    ];
    protected $hidden = [
        'jelszo', 'jelszoreset', 'hash'
    ];
    protected $table = 'Felhasznalo';
    public $timestamps = true;
    protected $softDelete = true;

    //----------------------------
    //----------------------------
    // RELATIONSHIP FUNCTIONS
    //----------------------------
    //----------------------------

    /**
     * Get the unique identifier for the user.
     *
     * @return mixed
     */
    public function getAuthIdentifier() {
        return $this->getKey();
    }

    /**
     * Get the password for the user.
     *
     * @return string
     */
    public function getAuthPassword() {
        return $this->jelszo;
    }

    /**
     * Get the e-mail address where password reminders are sent.
     *
     * @return string
     */
    public function getReminderEmail() {
        return $this->email;
    }

    public function getRememberToken() {
        return $this->remember_token;
    }

    public function setRememberToken($value) {
        $this->remember_token = $value;
    }

    public function getRememberTokenName() {
        return 'remember_token';
    }

}
'model' => 'Felhasznalo',
'table' => 'Felhasznalo',
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'jelszo1' in 'where clause' (SQL: select * from `Felhasznalo` where `email` = 832test@mail.com and `jelszo1` = 832test@mail.com limit 1) 
if (Auth::attempt(array(
                'email' => $email,
                'password' => $password
            ))) {
        echo 'Working';
    } else {
        echo 'Not working';
    }