public function testVector() { $input = 'hello world'; $pass = '******'; $vector = \base64_decode('Vpbd71CIVcRPALeSg126DhRKYozXlbusn/eSSxrQPtzj/U7hOhlN8D21Y0gmlmUKorpoXuDS6bklvD8='); $this->assertEquals($input, AesCtr::decrypt($vector, $pass)); }
public function testCrossDecryptFailure() { $pw = 'password'; $encrypted = \Dcrypt\Aes::encrypt('hello world', $pw); try { \Dcrypt\AesCtr::decrypt($encrypted, $pw); $this->assertTrue(false); } catch (\Exception $ex) { $this->assertTrue(true); } try { \Dcrypt\Mcrypt::decrypt($encrypted, $pw); $this->assertTrue(false); } catch (\Exception $ex) { $this->assertTrue(true); } $encrypted = \Dcrypt\AesCtr::encrypt('hello world', $pw); try { \Dcrypt\Aes::decrypt($encrypted, $pw); $this->assertTrue(false); } catch (\Exception $ex) { $this->assertTrue(true); } }