mcrypt-js

Mcrypt js encryption value is different than that produced by PHP mcrypt / Mcrypt JS decrypt doesn't work for UTF-8 chars

风格不统一 提交于 2019-11-27 15:15:44
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:

Mcrypt js encryption value is different than that produced by PHP mcrypt / Mcrypt JS decrypt doesn't work for UTF-8 chars

这一生的挚爱 提交于 2019-11-26 17:06:09
问题 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,