adrek Posted June 26, 2010 Share Posted June 26, 2010 Hi, Im trying to make an application that encrypts a string using the implementation of javascript and i need this string to be decrypted using the php mcrypt module. I know that client side encryption is not secure at all but unfortunately my script requires it. The problem that i am having is that i am getting two different outputs when using slowAES and mcrypt. I am using CBC mode. Can anyone help me out.? Thanks! this is how I cam calling slowAES. var cipher = slowAES.encrypt(cryptoHelpers.convertStringToByteArray("asdf"), 2, cryptoHelpers.toNumbers(stringToHex("1234567890987654")), 16, cryptoHelpers.toNumbers(stringToHex("1234567890987654"))); here is the PHP code function base16Encode($arg){ $ret=""; for($i=0;$i<strlen($arg);$i++){ $tmp=ord(substr($arg,$i,1)); $ret.=dechex($tmp); } return $ret; } $key="1234567890987654"; $transmitKey=base16Encode($key); $link="asdf"; $cp = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', ''); @mcrypt_generic_init($cp, $key,$key); $enc = mcrypt_generic($cp, $link); mcrypt_generic_deinit($cp); mcrypt_module_close($cp); Quote Link to comment Share on other sites More sharing options...
adrek Posted June 26, 2010 Author Share Posted June 26, 2010 I got this figured out. I used an easier script to implement based off of slow aes. its called ecmaScrypt if anyone is interested. http://www.josh-davis.org/ecmaScrypt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.