$cipher = MCRYPT_RIJNDAEL_256; $key = 'La blanquette est bonne'; $mode = 'cbc'; function cryptage($data, $key, $cipher, $mode){ return base64_encode(mcrypt_encrypt($cipher, md5($key), $data, $mode, md5($key))); } function decryptage($data, $key, $cipher, $mode){ return rtrim(mcrypt_decrypt($cipher, md5($key), base64_decode($data), $mode, md5($key))); }