php query string parameter
<p>Hi I've been scratching my head on this one even though it shouldn't be so difficult... I'm trying to pass an email through a GET query string NOT POST i want to mask this email i dont really care about having a good encryption or anything as long as the email isnt shown in the url... Anyways i was trying to encrypt it and decrypt it using mcrypt_generic. The issue im having is when encrypted it converts the email into a variety of characters such as: "ñ¯üŸPsúœœ á`agœ" i want to return normal alphanumeric character so i attempt to do a hex2bin on that and it works out great the issue is in php5 there is no bin2hex!!! and ive tried functions i found online to revert this change and it works as far as what you see but if you compare the strings in an if statement they dont match so of course when i dycrypt it, it doesnt return the same value i passed initially. Anyways I was wondering if anyone coudl give me some suggestions on hwo i could pass an email through a GET without the email being readable an then reverting it back to normal when the parameter is read by my code. Thanks in advance!!!</p>

<p>These are my encryption methods and the converter from hex2bin function:</p>

<pre><code>function encrypt($data)
{
$cipher = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, '');
if (mcrypt_generic_init($cipher, _QRYKEY, _IVKEY) != -1)
{
    $encrypted_data = mcrypt_generic($cipher,$data );
    mcrypt_generic_deinit($cipher);
}

return bin2hex($encrypted_data);
}

function decrypt($data)
{
$cipher = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, '');
if (mcrypt_generic_init($cipher, _QRYKEY, _IVKEY) != -1)
{
    $decrypted_data = mdecrypt_generic($cipher,hex2bin($data));
    mcrypt_generic_deinit($cipher);
}

return $decrypted_data;
}

function hex2bin($h)
{
if (!is_string($h)) return null;

$r='';
for($a=0; $a&lt;strlen($h); $a+=2)
{
    $r.=chr(hexdec($h{$a}.$h{($a+1)})); 
}

return $r;
}
</code></pre>
