- base64_encode: documentation ( source)
- md5: documentation ( source)
<?php
$expected_result = "MeO+OkLlLR7+3acBmx40mXUq9/2jyB7Bgk4HPCMMOZWm0Q8ImAaNNxmb5Ukjl6lS+nRyYOTYvi2KP3D+7PIKpQ==";
$key = "nkCrEY3Lek2GHVC9Yfg6LK00dWYat88L";
$savedUser = "test1user1";
$movieID = "asd90asd89f7d9";
$fileName = "myporn.mp4";
$message = "id=" . $movieID . "&username=" . $savedUser . "&filename=" . $fileName;
$myVarIWantToEncodeAndDecode = $message;
echo ($message);
$iv = md5(md5($key));
$iv = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$encoded = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, ($key), $myVarIWantToEncodeAndDecode, MCRYPT_MODE_CBC, $iv ));
echo ("\r\nPHP Key:".$encoded ."\r\n<br>");
echo ("\r\n Expect: ".$expected_result ."\r\n<br>");