Back to Mcrypt class

Method isSupported

public bool
isSupported
()
Is this adapter supported?
Returns
  • bool
Class: Mcrypt
Project: Joomla

Method isSupported - Source code

/**
 * Is this adapter supported?
 *
 * @return  boolean
 */
public function isSupported()
{
    if (!\function_exists('mcrypt_get_key_size')) {
        return false;
    }
    if (!\function_exists('mcrypt_get_iv_size')) {
        return false;
    }
    if (!\function_exists('mcrypt_create_iv')) {
        return false;
    }
    if (!\function_exists('mcrypt_encrypt')) {
        return false;
    }
    if (!\function_exists('mcrypt_decrypt')) {
        return false;
    }
    if (!\function_exists('mcrypt_list_algorithms')) {
        return false;
    }
    if (!\function_exists('hash')) {
        return false;
    }
    if (!\function_exists('hash_algos')) {
        return false;
    }
    $algorigthms = mcrypt_list_algorithms();
    if (!\in_array('rijndael-128', $algorigthms)) {
        return false;
    }
    if (!\in_array('rijndael-192', $algorigthms)) {
        return false;
    }
    if (!\in_array('rijndael-256', $algorigthms)) {
        return false;
    }
    $algorigthms = hash_algos();
    if (!\in_array('sha256', $algorigthms)) {
        return false;
    }
    return true;
}