Blowfish encryption in php
I'm writing an encryption to my application and website, but I don't know how to correctly encrypt the string in php. Decryption is already done by this code: function decrypt_blowfish($data,$key){ $iv=pack("H*" , substr($data,0,16)); $key=pack("H*" , $key); $x =pack("H*" , substr($data,16)); $res = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $x , MCRYPT_MODE_CBC, $iv); return $res; } I tried with simple: function encrypt_blowfish($data,$key){ $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $crypttext = mcrypt_encrypt(MCRYPT_BLOWFISH,