相关疑难解决方法(0)

散列和加密算法之间的根本区别

我看到哈希和加密算法之间存在很多混淆,我希望听到一些更专业的建议:

  1. 何时使用哈希与加密

  2. 什么使哈希或加密算法不同(从理论/数学水平),即什么使哈希不可逆(没有彩虹树的帮助)

以下是一些类似的 SO问题,没有像我想要的那样详细说明:

混淆,散列和加密有什么区别?
加密和散列之间的区别

security encryption hash cryptography

494
推荐指数
10
解决办法
20万
查看次数

如何解密bcrypt存储的哈希值

我有这个加密密码的脚本,但我不知道如何反转它并解密它.这可能是一个非常简单的答案,但我不明白该怎么做.

#!/usr/bin/perl
use Crypt::Eksblowfish::Bcrypt;
use Crypt::Random;

$password = 'bigtest';
$encrypted = encrypt_password($password);
print "$password is encrypted as $encrypted\n";

print "Yes the password is $password\n" if check_password($password, $encrypted);
print "No the password is not smalltest\n" if !check_password('smalltest', $encrypted);

# Encrypt a password 
sub encrypt_password {
    my $password = shift;

    # Generate a salt if one is not passed
    my $salt = shift || salt(); 

    # Set the cost to 8 and append a NUL
    my $settings = '$2a$08$'.$salt;

    # Encrypt it …
Run Code Online (Sandbox Code Playgroud)

perl bcrypt

29
推荐指数
1
解决办法
8万
查看次数

如何在laravel 4中匹配输入密码和数据库哈希密码

如何在Laravel中从给定请求验证用户密码?如何根据存储在数据库中的密码哈希检查密码?

php laravel laravel-4

6
推荐指数
3
解决办法
2万
查看次数

Laravel 使用 Bcrypt 密码创建第一条记录

我可以通过迁移在数据库中创建第一条记录吗,其中password列中的第一条记录已经被加密

public function up()
{
    Schema::create('users', function (Blueprint $table) {
        $table->id();
        $table->string('name');
        $table->string('email');
        $table->string('level');
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->rememberToken();
        $table->timestamps();
    });

    User::firstOrCreate([
        'name' => 'admin',
        'email' => 'admin@app.com',
        'level' => 'Administrator',
        'password' => 'password'
    ]);
}
Run Code Online (Sandbox Code Playgroud)

代码可以工作,但未password加密,有什么建议吗?

database migration bcrypt laravel

2
推荐指数
1
解决办法
272
查看次数

Laravel 4:自定义登录和检查密码

我想定制我的登录界面,在laravel 4,其中username要么是他username还是email那么我所做的是:

public static function custom_login($uname,$pwd)
{
    $res = DB::select("select * from users where (username = ? or email = ?) and password = ? and active = 1",array($uname,$uname,$pwd));
            return $res;
}
Run Code Online (Sandbox Code Playgroud)

现在,我们都知道密码是哈希的,所以你无法使用password = ?.如果密码正确,我怎么检查密码?

php mysql laravel laravel-4 laravel-3

1
推荐指数
1
解决办法
5602
查看次数