title: Laravel decrypt() throws "DecryptException The payload is invalid."
body: <p>I have my authenticated user, and for debugging, I am trying to show his password using decrypt (as it is encrypted using <code>encrypt()</code>.</p>
  
  <p>To simplify things, I create a new route <code>/test</code> and I can see the encrypted password of the authenticated user like so:</p>
  
  <pre><code>Route::get('/test', function() {
      dd(Auth::user()-&gt;password)
  });
  </code></pre>
  
  <p>This returns me: <code>$2y$10$gdhYnCekBownWU62OitC6uSwoONfDWGO23FnaVwIgFPAeJI9L6DEa</code></p>
  
  <hr>
  
  <p>But if I try using, it throws me this error: </p>
  
  <pre><code>Route::get('/test', function() {
      dd(decrypt(Auth::user()-&gt;password))
  });
  </code></pre>
  
  <blockquote>
    <p>DecryptException: The payload is invalid.</p>
  </blockquote>
  
  <hr>
  
  <p>I tried searching around regarding this issue, and two things I found were: </p>
  
  <p>1) "Make sure app key is proper." It was there before, but to be sure, I run <code>php artisan key:generate</code> again. Nothing has changed.</p>
  
  <p>2) "It is a CSRF issue". I disabled the csrf from middleware kernel in web, nothing has changed either. And I am not using post request, so I doubt this is my issue. </p>
  
  <hr>
  
  <p>I need it because the scenario looks like this: I need to decrypt the password because I am generating a random password using this approach beforehand, and saved it to database; and I want to keep this approach.</p>
  
  <pre><code>$randomPassword = rand(111111,999999);
  $user-&gt;password = encrypt($randomPassword);
  $user-&gt;save();
  </code></pre>
  
  <p>Does anyone know what is the reason of this or how to overcome it?</p>