replaced depricated mcrypt_generic_end, which 4.1.1+ mcrypt_generic_deinit, as it gaves warnings in php5

This commit is contained in:
Ralf Becker 2005-10-27 09:26:08 +00:00
parent 7ddeb1010f
commit 809bbaccda

View File

@ -79,22 +79,17 @@
$key = substr($key, 0, mcrypt_enc_get_key_size($GLOBALS['td'])); $key = substr($key, 0, mcrypt_enc_get_key_size($GLOBALS['td']));
mcrypt_generic_init($GLOBALS['td'], $key, $iv); mcrypt_generic_init($GLOBALS['td'], $key, $iv);
$p_t = trim(mdecrypt_generic($GLOBALS['td'], $c_t)); //trim to remove padding $p_t = mdecrypt_generic($GLOBALS['td'], $c_t);
/* Clean up */ /* Clean up */
mcrypt_generic_end($GLOBALS['td']); mcrypt_generic_deinit($GLOBALS['td']);
mcrypt_module_close($GLOBALS['td']); mcrypt_module_close($GLOBALS['td']);
} }
@mcrypt_module_close($GLOBALS['td']);
if(strncmp($p_t, $plain_text, strlen($plain_text)) == 0)
{
return True;
}
else else
{ {
return False; @mcrypt_module_close($GLOBALS['td']);
} }
return rtrim($p_t) === $plain_text;
} }
/* run a self-test through every listed cipher and mode - from robert at peakepro dot com (php.net manual) */ /* run a self-test through every listed cipher and mode - from robert at peakepro dot com (php.net manual) */