Php 如何解码laravel 5中的哈希值?

Php 如何解码laravel 5中的哈希值?,php,laravel,encryption,laravel-5,decode,Php,Laravel,Encryption,Laravel 5,Decode,我必须将哈希密码转换为字符串 这是我的密码 <?php namespace App\Http\Controllers; use DB; use Auth; use Input; use Session; use Route; use Crypt; use Redirect; use Illuminate\Http\Request; use Illuminate\Http\Dispatcher;

我必须将哈希密码转换为字符串

这是我的密码

<?php namespace App\Http\Controllers;
     use DB;
     use Auth;
     use Input;
     use Session;
     use Route;
     use Crypt;
     use Redirect;
     use Illuminate\Http\Request;
     use Illuminate\Http\Dispatcher; 

      $userdata = array(
                'email'     => $email,
                'password'  =>  Crypt::decrypt($password)
            );
谁能建议我怎么做

谢谢。

使用
Crypt::decrypt()

注意:必须使用用于加密的密钥对值进行解密。

Laravel的加密例程使用
Config::get('app.key')
进行加密。这在内部发生。由于每个Laravel应用程序的值都不同,因此加密值的应用程序也必须解密该值

或者

解密之前,应用程序必须调用
Crypt::setKey()
,以将密钥与用于加密的值匹配。请参阅设置加密密钥

使用加密

Crypt::setKey($key);
此密钥将用于后续的
Crypt::encrypt()
Crypt::decrypt()
调用


是否使用Crypt::encrypt进行加密?加密哈希是单向函数,在给定哈希的情况下,实际上不可能返回原始文本。请参阅此处的详细信息:密码字符串必须不可解密!否则,这与以明文形式保存密码相同。您只能对使用Crypt::encrypt加密的字符串使用Crypt::decrypt,因此我建议使用Crypt:加密密码:encrypt@Akshay我没有使用Crypt::encrypt。谢谢Abdulla,可以使用Crypt::decrypt();因为我在那样使用时出错了。因此,根据我在Laravel 5.1中的知识,您必须对值进行加密,对Crypt::setKey的支持已在@AbdullaThanks每个人处取消。现在,我使用Crypt::encrypt($password)在用户注册时加密我的密码,并使用Crypt::decrypt($userdata['password'])转换为descrypt;我终于得到了我的descrypt密码。这个密码正常了,只是你需要在数据库=)中将保存的值设为
longtext
。#
$value = Crypt::decrypt($encrypted);
Crypt::setKey($key);