Mcrypt js encryption value is different than that produced by PHP mcrypt / Mcrypt JS decrypt doesn't work for UTF-8 chars
I have been trying to implement mcrypt encryption/ decryption technique on both server end, PHP and client end. I am trying to use mcrypt.js library at the moment as: <?php $key = 'testtesttesttesttesttesttesttest'; function string_encrypt($string, $key) { $crypted_text = mcrypt_encrypt( MCRYPT_RIJNDAEL_128, $key, $string, MCRYPT_MODE_ECB ); return base64_encode($crypted_text); } function string_decrypt($encrypted_string, $key) { $decrypted_text = mcrypt_decrypt( MCRYPT_RIJNDAEL_128, $key, base64_decode($encrypted_string), MCRYPT_MODE_ECB ); return trim($decrypted_text); } echo 'Provided Text: