1--TEST--
2Crypto\Cipher::__construct basic usage.
3--FILE--
4<?php
5// basic creation
6$cipher = new Crypto\Cipher('aes-256-cbc');
7if ($cipher instanceof Crypto\Cipher)
8	echo "FOUND\n";
9// invalid creation
10try {
11	$cipher = new Crypto\Cipher('nnn');
12}
13catch (Crypto\CipherException $e) {
14	if ($e->getCode() === Crypto\CipherException::ALGORITHM_NOT_FOUND) {
15		echo "NOT FOUND\n";
16	}
17}
18
19$cipher = new Crypto\Cipher('aes', Crypto\Cipher::MODE_CBC, 256);
20echo $cipher->getAlgorithmName() . "\n";
21$cipher = new Crypto\Cipher('RC4');
22echo $cipher->getAlgorithmName() . "\n";
23$cipher = new Crypto\Cipher('RC4', "40");
24echo $cipher->getAlgorithmName() . "\n";
25$cipher = new Crypto\Cipher('aes', "cfb8", 128);
26echo $cipher->getAlgorithmName() . "\n";
27
28// sub classing
29class SubCipher extends Crypto\Cipher {
30	function __construct($algorithm, $mode = null, $key_size = null) {
31		parent::__construct($algorithm, $mode, $key_size);
32		echo $this->algorithm . "\n";
33	}
34}
35$subcipher = new SubCipher('aes-256-cbc');
36$subcipher = new SubCipher('aes', Crypto\Cipher::MODE_CBC, 256);
37?>
38--EXPECT--
39FOUND
40NOT FOUND
41AES-256-CBC
42RC4
43RC4-40
44AES-128-CFB8
45AES-256-CBC
46AES-256-CBC
47
48