I'm fairly new to PHP and very new to encrypting using PHP, I've read up on some forums and watched some videos about it however as much as I try, it never encrypts properly. This is my code below to test (I know I shouldn't be md5 it's just to see if it works at first).
When I run this code on my website it tells me page is not responding meaning there is an error, however I cannot spot one or see where I went wrong.
<?php
$key = md5('pass');
function encrypt($string, $key){
$string = rtrim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $string, MCRYPT_MODE_ECB)));
return $string;
}
$output = encrypt("test", $key);
echo $output;
?>