Exemplo n.º 1
0
 /**
  * @dataProvider provideTestEncryptVectors
  * @group Vectors
  */
 public function testEncrypt($key, $data, $expected)
 {
     $cipher = new \CryptLib\Cipher\Block\Cipher\DES('des');
     $cipher->setKey(pack('H*', $key));
     $enc = $cipher->encryptBlock(pack('H*', $data));
     $this->assertEquals($expected, strtoupper(bin2hex($enc)));
 }
Exemplo n.º 2
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testEncryptFailure2()
 {
     $cipher = new \CryptLib\Cipher\Block\Cipher\DES('des');
     $cipher->setKey('foobarba');
     $enc = $cipher->encryptBlock('ab');
 }