phpseclib\Net\SSH2::_encryption_algorithm_to_crypt_instance PHP Method

_encryption_algorithm_to_crypt_instance() public method

Maps an encryption algorithm name to an instance of a subclass of \phpseclib\Crypt\Base.
public _encryption_algorithm_to_crypt_instance ( string $algorithm ) : mixed
$algorithm string Name of the encryption algorithm
return mixed Instance of \phpseclib\Crypt\Base or null for unknown
    function _encryption_algorithm_to_crypt_instance($algorithm)
    {
        switch ($algorithm) {
            case '3des-cbc':
                return new TripleDES(BlockCipher::MODE_CBC);
            case '3des-ctr':
                return new TripleDES(BlockCipher::MODE_CTR);
            case 'aes256-cbc':
            case 'aes192-cbc':
            case 'aes128-cbc':
                return new Rijndael(BlockCipher::MODE_CBC);
            case 'aes256-ctr':
            case 'aes192-ctr':
            case 'aes128-ctr':
                return new Rijndael(BlockCipher::MODE_CTR);
            case 'blowfish-cbc':
                return new Blowfish(BlockCipher::MODE_CBC);
            case 'blowfish-ctr':
                return new Blowfish(BlockCipher::MODE_CTR);
            case 'twofish128-cbc':
            case 'twofish192-cbc':
            case 'twofish256-cbc':
            case 'twofish-cbc':
                return new Twofish(BlockCipher::MODE_CBC);
            case 'twofish128-ctr':
            case 'twofish192-ctr':
            case 'twofish256-ctr':
                return new Twofish(BlockCipher::MODE_CTR);
            case 'arcfour':
            case 'arcfour128':
            case 'arcfour256':
                return new RC4();
        }
        return null;
    }