mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-20 04:00:55 +00:00
Tests: CS adjustments
This commit is contained in:
parent
9a55ab1892
commit
4d6e7efda6
@ -11,7 +11,7 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
|
|||||||
{
|
{
|
||||||
protected $engine;
|
protected $engine;
|
||||||
|
|
||||||
private function checkEngine($aes)
|
private function _checkEngine($aes)
|
||||||
{
|
{
|
||||||
if ($aes->getEngine() != $this->engine) {
|
if ($aes->getEngine() != $this->engine) {
|
||||||
$engine = 'internal';
|
$engine = 'internal';
|
||||||
@ -78,7 +78,7 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
|
|||||||
$aes->setIV($iv);
|
$aes->setIV($iv);
|
||||||
$aes->setKey($key);
|
$aes->setKey($key);
|
||||||
|
|
||||||
$this->checkEngine($aes);
|
$this->_checkEngine($aes);
|
||||||
|
|
||||||
$actual = '';
|
$actual = '';
|
||||||
for ($i = 0, $strlen = strlen($plaintext); $i < $strlen; ++$i) {
|
for ($i = 0, $strlen = strlen($plaintext); $i < $strlen; ++$i) {
|
||||||
@ -100,7 +100,7 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
|
|||||||
$aes->setPreferredEngine($this->engine);
|
$aes->setPreferredEngine($this->engine);
|
||||||
$aes->disablePadding();
|
$aes->disablePadding();
|
||||||
$aes->setKey(pack('H*', '2b7e151628aed2a6abf7158809cf4f3c762e7160')); // 160-bit key. Valid in Rijndael.
|
$aes->setKey(pack('H*', '2b7e151628aed2a6abf7158809cf4f3c762e7160')); // 160-bit key. Valid in Rijndael.
|
||||||
//$this->checkEngine($aes); // should only work in internal mode
|
//$this->_checkEngine($aes); // should only work in internal mode
|
||||||
$ciphertext = $aes->encrypt(pack('H*', '3243f6a8885a308d313198a2e0370734'));
|
$ciphertext = $aes->encrypt(pack('H*', '3243f6a8885a308d313198a2e0370734'));
|
||||||
$this->assertEquals($ciphertext, pack('H*', '231d844639b31b412211cfe93712b880'));
|
$this->assertEquals($ciphertext, pack('H*', '231d844639b31b412211cfe93712b880'));
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
|
|||||||
$aes->setPreferredEngine($this->engine);
|
$aes->setPreferredEngine($this->engine);
|
||||||
$aes->disablePadding();
|
$aes->disablePadding();
|
||||||
$aes->setKey(pack('H*', '2b7e151628aed2a6abf7158809cf4f3c762e7160')); // 160-bit key. AES should null pad to 192-bits
|
$aes->setKey(pack('H*', '2b7e151628aed2a6abf7158809cf4f3c762e7160')); // 160-bit key. AES should null pad to 192-bits
|
||||||
$this->checkEngine($aes);
|
$this->_checkEngine($aes);
|
||||||
$ciphertext = $aes->encrypt(pack('H*', '3243f6a8885a308d313198a2e0370734'));
|
$ciphertext = $aes->encrypt(pack('H*', '3243f6a8885a308d313198a2e0370734'));
|
||||||
$this->assertEquals($ciphertext, pack('H*', 'c109292b173f841b88e0ee49f13db8c0'));
|
$this->assertEquals($ciphertext, pack('H*', 'c109292b173f841b88e0ee49f13db8c0'));
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
|
|||||||
$aes->setKey($key);
|
$aes->setKey($key);
|
||||||
$aes->setIV($iv);
|
$aes->setIV($iv);
|
||||||
|
|
||||||
$this->checkEngine($aes);
|
$this->_checkEngine($aes);
|
||||||
|
|
||||||
$str = '';
|
$str = '';
|
||||||
$result = '';
|
$result = '';
|
||||||
@ -193,7 +193,7 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
|
|||||||
$aes->setKey($key);
|
$aes->setKey($key);
|
||||||
$aes->setIV($iv);
|
$aes->setIV($iv);
|
||||||
|
|
||||||
$this->checkEngine($aes);
|
$this->_checkEngine($aes);
|
||||||
|
|
||||||
foreach ($test as $len) {
|
foreach ($test as $len) {
|
||||||
$temp = str_repeat('d', $len);
|
$temp = str_repeat('d', $len);
|
||||||
|
Loading…
Reference in New Issue
Block a user