Decrypt -> The payload is invalid
Hello,
I encrypted a password with salt, then decrypted it.
$pw = encrypt( $request->input( 'password' ) . $salt );
Then I saved it in the database. After loading it again and decrypted it, I got the error message: The payload is invalid.
$pw = $this->removeSalt(decrypt($result->password));
What's wrong?
The encrypt method is already salting the data, so you don't need to do that yourself as well!
This should work fine
$password = 'pass1234';
$encryptedPassword = encrypt($password);
$decryptedPassword = decrypt($encryptedPassword);
$password == $decryptedPassword // true
It works well, thank you!
Please or to participate in this conversation.