title: Converting Laravel's AES 256 Encryptor to C#
body: <p>I need to create the same results when using <code>Crypt::Encrypt('secret')</code> from Laravel, in C#. 
  I found this thread <a href="https://stackoverflow.com/questions/3431950/rijndael-256-encrypt-decrypt-between-c-sharp-and-php">Rijndael 256 Encrypt/decrypt between c# and php?</a>
  and it seemed to be what I need, but I'm having some trouble with the third argument the, initialization vector :(. </p>
  
  <p>Laravel using Rijndael AES to encrypt the data. All the user has to input is a secret key, in the config folder, that is totally random and 32 characters long. </p>
  
  <p>The encyrption method looks like this:</p>
  
  <pre><code>public function encrypt($value)
      {
          $iv = mcrypt_create_iv($this-&gt;getIvSize(), $this-&gt;getRandomizer());
  
          $value = base64_encode($this-&gt;padAndMcrypt($value, $iv));
  
          // Once we have the encrypted value we will go ahead base64_encode the input
          // vector and create the MAC for the encrypted value so we can verify its
          // authenticity. Then, we'll JSON encode the data in a "payload" array.
          $mac = $this-&gt;hash($iv = base64_encode($iv), $value);
  
          return base64_encode(json_encode(compact('iv', 'value', 'mac')));
      }
  </code></pre>
  
  <p>The full Encryptor.php can be found here: <a href="http://pastebin.com/yfWLPxGn" rel="nofollow noreferrer">http://pastebin.com/yfWLPxGn</a></p>
  
  <p>Any idea as to what I would have to input to get the same results? :)</p>