1--TEST-- 2Crypto\Cipher::__callStatic basic usage. 3--FILE-- 4<?php 5// basic creation 6$cipher = 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 = Crypto\Cipher::aes(Crypto\Cipher::MODE_CBC, 256); 20echo $cipher->getAlgorithmName() . "\n"; 21$cipher = Crypto\Cipher::rc4(); 22echo $cipher->getAlgorithmName() . "\n"; 23$cipher = Crypto\Cipher::rc4("40"); 24echo $cipher->getAlgorithmName() . "\n"; 25$cipher = Crypto\Cipher::aes("cfb8", 128); 26echo $cipher->getAlgorithmName() . "\n"; 27 28?> 29--EXPECT-- 30FOUND 31NOT FOUND 32AES-256-CBC 33RC4 34RC4-40 35AES-128-CFB8 36 37