Trying to reproduce a javascript b64_md5 function with PHP, but results differ

  base64, javascript, md5, php

I am trying to tap into an existing web application that uses the b64_md5 js function to encrypt a password before sending it to the server for security purposes. My script uses PHP and PHP Curl, but I can’t seem to get the same result using php and the same inputs.

Here is the JS that generates the encrypted password using the following script:

var PasswordMD5 = encodeURIComponent(b64_md5("[email protected]"));

That function returns:

I’m trying to match that result using PHP. Here is what I’ve got, but it’s not generating a matching result.

$passwordMD5 = base64_encode(md5("[email protected]"));
echo $passwordMD5;

That function returns:

Are there any md5/encoding gurus out there that can help me figure this out?

Source: Ask PHP