1--TEST-- 2Crypto\Cipher::encryptUpdate basic usage. 3--FILE-- 4<?php 5$key = str_repeat('x', 32); 6$iv = str_repeat('i', 16); 7 8$data = str_repeat('a', 16); 9 10$cipher = new Crypto\Cipher('aes-256-cbc'); 11// invalid order 12try { 13 $cipher->encryptUpdate('ddd'); 14} 15catch (Crypto\CipherException $e) { 16 if ($e->getCode() === Crypto\CipherException::UPDATE_ENCRYPT_FORBIDDEN) { 17 echo "UPDATE STATUS\n"; 18 } 19} 20// init first 21$cipher->encryptInit($key, $iv); 22echo bin2hex($cipher->encryptUpdate($data)) . "\n"; 23 24?> 25--EXPECT-- 26UPDATE STATUS 278f8853a1685607133cb9ee0fc7a5b8a5 28