How can i decode hash value in laravel 5?
35,158
Use Crypt::decrypt()
$value = Crypt::decrypt($encrypted);
Note : You must decrypt the value with the same key used to encrypt it.
Laravel's encryption routines use
Config::get('app.key')
for encryption. This happens internally. Since this value is different for every Laravel application then the application that encrypts a value must also decrypt the value.Or ...
The application must call
Crypt::setKey()
prior todecrypting
to match the key to the value used for encrypting. See Setting the Encryption Key.
To Encryption use
Crypt::setKey($key);
This key will be used for subsequent
Crypt::encrypt()
andCrypt::decrypt()
calls.
Author by
Aniruddha Mishra
Updated on August 15, 2020Comments
-
Aniruddha Mishra over 3 years
I have to convert my hash password into string.
here is my code.
<?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) );
when i use Crypt::decrypt i get error . error-
DecryptException in BaseEncrypter.php line 45: The payload is invalid.
Can any one suggest me how can i do that?
Thanks.