Zend Encrypt and Decrypt
<p>I have the below class:</p>



<pre class="lang-php prettyprint-override"><code>&lt;?php

class Application_Model_Classes_Cryptography
{
    private static $key  = "thisisakeytolock";
    private static $vector= "myvector";

    public static function encrypt($data)
    {
        $filter = new Zend_Filter_Encrypt(array('adapter' =&gt; 'mcrypt', 'key' =&gt; Application_Model_Classes_Cryptography::$key));
        $filter-&gt;setVector(Application_Model_Classes_Cryptography::$vector);
        $encrypted = $filter-&gt;filter($data);
        return utf8_encode(base64_encode($encrypted));
    }

    public static function decrypt($data)
    {
        $filter = new Zend_Filter_Decrypt(array('adapter' =&gt; 'mcrypt', 'key' =&gt; Application_Model_Classes_Cryptography::$key));
        $filter-&gt;setVector(Application_Model_Classes_Cryptography::$vector);
        $decrypted = $filter-&gt;filter(base64_decode(utf8_decode($data)));
        return $decrypted;
    }
}
</code></pre>

<p>but when I use those methods though the result seems correct but does't work</p>

<pre class="lang-php prettyprint-override"><code>$varData = 'someinformation';
$conData = Application_Model_Classes_Cryptography::decrypt(Application_Model_Classes_Cryptography::encrypt($varData));

echo $varData;
echo $conData;

if($varData == $conData) echo "equal";
else echo "not equal";
</code></pre>

<p>here is the result:</p>

<pre class="lang-php prettyprint-override"><code>someinformation
someinformation
not equal
</code></pre>

<p>can anyone please help me in understanding what's wrong here.</p>

<p>basically I want to send some encrypted information and once receive in the other server want to decrypt and extract that information. but the problem is that the the information seems to be the same but doesn't compare. I have tried adding the utf8_encode and decode in the methods as you can see in there, but no gain.</p>

<p><strong>System Details:</strong><br>
<strong>OS:</strong> Mac OS X 10.11<br>
<strong>MAMP:</strong> 3.5<br>
<strong>PHP:</strong> 5.6.10<br></p>