diff --git a/phpseclib/Common/Functions/Objects.php b/phpseclib/Common/Functions/Objects.php index a3cec551..87d17fbf 100644 --- a/phpseclib/Common/Functions/Objects.php +++ b/phpseclib/Common/Functions/Objects.php @@ -64,7 +64,7 @@ abstract class Objects * @return mixed * @access public */ - public static function callFunc($obj, $func, $params = array()) + public static function callFunc($obj, $func, $params = []) { $reflection = new \ReflectionClass(get_class($obj)); $method = $reflection->getMethod($func); diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index ed1dd893..8e700bee 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -2384,10 +2384,10 @@ class X509 $this->currentCert = [ 'tbsCertificate' => - array( + [ 'version' => 'v3', 'serialNumber' => $serialNumber, // $this->setserialNumber() - 'signature' => array('algorithm' => $signatureAlgorithm), + 'signature' => ['algorithm' => $signatureAlgorithm], 'issuer' => false, // this is going to be overwritten later 'validity' => [ 'notBefore' => $this->timeField($startDate), // $this->setStartDate() @@ -2395,7 +2395,7 @@ class X509 ], 'subject' => $subject->dn, 'subjectPublicKeyInfo' => $subjectPublicKey - ), + ], 'signatureAlgorithm' => ['algorithm' => $signatureAlgorithm], 'signature' => false // this is going to be overwritten later ]; @@ -3467,7 +3467,7 @@ class X509 // the former is a good example of how to do fuzzing on the public key //return new Element(preg_replace('#-.+-|[\r\n]#', '', $this->publicKey->getPublicKey())); return [ - 'algorithm' => array('algorithm' => 'rsaEncryption'), + 'algorithm' => ['algorithm' => 'rsaEncryption'], 'subjectPublicKey' => $this->publicKey->getPublicKey('PKCS1') ]; } diff --git a/phpseclib/Math/BigInteger/Engines/PHP.php b/phpseclib/Math/BigInteger/Engines/PHP.php index 19e7a1f1..df90092a 100644 --- a/phpseclib/Math/BigInteger/Engines/PHP.php +++ b/phpseclib/Math/BigInteger/Engines/PHP.php @@ -243,7 +243,7 @@ abstract class PHP extends Engine if ($x_negative != $y_negative) { if ($x_value == $y_value) { return [ - self::VALUE => array(), + self::VALUE => [], self::SIGN => false ]; } diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 3e9a3a6f..73fdbcf6 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3645,7 +3645,7 @@ class SSH2 return $data; } if (!isset($this->channel_buffers[$channel])) { - $this->channel_buffers[$channel] = array(); + $this->channel_buffers[$channel] = []; } $this->channel_buffers[$channel][] = $data; diff --git a/tests/Functional/Net/SCPSSH2UserStoryTest.php b/tests/Functional/Net/SCPSSH2UserStoryTest.php index 41e86e95..05e85103 100644 --- a/tests/Functional/Net/SCPSSH2UserStoryTest.php +++ b/tests/Functional/Net/SCPSSH2UserStoryTest.php @@ -63,12 +63,12 @@ class Functional_Net_SCPSSH2UserStoryTest extends PhpseclibFunctionalTestCase // TODO: Address https://github.com/phpseclib/phpseclib/issues/146 $this->assertContains( strlen($content), - array(self::$exampleDataLength, self::$exampleDataLength + 1), + [self::$exampleDataLength, self::$exampleDataLength + 1], 'Failed asserting that string length matches expected length.' ); $this->assertContains( $content, - array(self::$exampleData, self::$exampleData . "\0"), + [self::$exampleData, self::$exampleData . "\0"], 'Failed asserting that string content matches expected content.' ); return $scp; @@ -88,12 +88,12 @@ class Functional_Net_SCPSSH2UserStoryTest extends PhpseclibFunctionalTestCase // TODO: Address https://github.com/phpseclib/phpseclib/issues/146 $this->assertContains( filesize($localFilename), - array(self::$exampleDataLength, self::$exampleDataLength + 1), + [self::$exampleDataLength, self::$exampleDataLength + 1], 'Failed asserting that filesize matches expected data size.' ); $this->assertContains( file_get_contents($localFilename), - array(self::$exampleData, self::$exampleData . "\0"), + [self::$exampleData, self::$exampleData . "\0"], 'Failed asserting that file content matches expected content.' ); } diff --git a/tests/Functional/Net/SFTPStreamTest.php b/tests/Functional/Net/SFTPStreamTest.php index 83602359..9507aca3 100644 --- a/tests/Functional/Net/SFTPStreamTest.php +++ b/tests/Functional/Net/SFTPStreamTest.php @@ -18,9 +18,9 @@ class Functional_Net_SFTPStreamTest extends Functional_Net_SFTPTestCase public function testFopenFcloseCreatesFile() { - $context = stream_context_create(array( - 'sftp' => array('session' => $this->sftp), - )); + $context = stream_context_create([ + 'sftp' => ['session' => $this->sftp], + ]); $fp = fopen($this->buildUrl('fooo.txt'), 'wb', false, $context); $this->assertTrue(is_resource($fp)); fclose($fp); @@ -32,9 +32,9 @@ class Functional_Net_SFTPStreamTest extends Functional_Net_SFTPTestCase */ public function testFilenameWithHash() { - $context = stream_context_create(array( - 'sftp' => array('session' => $this->sftp), - )); + $context = stream_context_create([ + 'sftp' => ['session' => $this->sftp], + ]); $fp = fopen($this->buildUrl('te#st.txt'), 'wb', false, $context); fputs($fp, 'zzzz'); fclose($fp); @@ -52,7 +52,7 @@ class Functional_Net_SFTPStreamTest extends Functional_Net_SFTPTestCase $session = $this->sftp; $dirs = scandir("sftp://$session/"); $this->assertCount($originalConnectionsCount, \phpseclib\Net\SSH2::getConnections()); - $this->assertEquals(array('.', '..'), array_slice($dirs, 0, 2)); + $this->assertEquals(['.', '..'], array_slice($dirs, 0, 2)); } protected function buildUrl($suffix) diff --git a/tests/Functional/Net/SFTPUserStoryTest.php b/tests/Functional/Net/SFTPUserStoryTest.php index 57524d40..b66e3496 100644 --- a/tests/Functional/Net/SFTPUserStoryTest.php +++ b/tests/Functional/Net/SFTPUserStoryTest.php @@ -127,7 +127,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase public function testStatOnDir($sftp) { $this->assertNotSame( - array(), + [], $sftp->stat('.'), 'Failed asserting that the cwd has a non-empty stat.' ); @@ -177,7 +177,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase { self::$buffer = self::$exampleData; $this->assertTrue( - $sftp->put('file1.txt', array(__CLASS__, 'callback'), $sftp::SOURCE_CALLBACK), + $sftp->put('file1.txt', [__CLASS__, 'callback'], $sftp::SOURCE_CALLBACK), 'Failed asserting that example data could be successfully put().' ); @@ -325,7 +325,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase $sftp->setListOrder('filename', SORT_DESC); $list = $sftp->nlist(); - $expected = array('.', '..', 'temp', 'file3.txt', 'file2.txt', 'file1.txt'); + $expected = ['.', '..', 'temp', 'file3.txt', 'file2.txt', 'file1.txt']; $this->assertSame( $list, @@ -336,7 +336,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase $sftp->setListOrder('filename', SORT_ASC); $list = $sftp->nlist(); - $expected = array('.', '..', 'temp', 'file1.txt', 'file2.txt', 'file3.txt'); + $expected = ['.', '..', 'temp', 'file1.txt', 'file2.txt', 'file3.txt']; $this->assertSame( $list, diff --git a/tests/Functional/Net/SSH2AgentTest.php b/tests/Functional/Net/SSH2AgentTest.php index f9b03b46..3ff299f1 100644 --- a/tests/Functional/Net/SSH2AgentTest.php +++ b/tests/Functional/Net/SSH2AgentTest.php @@ -31,7 +31,7 @@ class Functional_Net_SSH2AgentTest extends PhpseclibFunctionalTestCase 'SSH2 login using Agent failed.' ); - return array('ssh' => $ssh, 'ssh-agent' => $agent); + return ['ssh' => $ssh, 'ssh-agent' => $agent]; } /** diff --git a/tests/Functional/Net/SSH2Test.php b/tests/Functional/Net/SSH2Test.php index 9a9abf20..f6be7d25 100644 --- a/tests/Functional/Net/SSH2Test.php +++ b/tests/Functional/Net/SSH2Test.php @@ -108,12 +108,12 @@ class Functional_Net_SSH2Test extends PhpseclibFunctionalTestCase */ public function testExecWithMethodCallback($ssh) { - $callbackObject = $this->getMock('stdClass', array('callbackMethod')); + $callbackObject = $this->getMock('stdClass', ['callbackMethod']); $callbackObject ->expects($this->atLeastOnce()) ->method('callbackMethod') ->will($this->returnValue(true)); - $ssh->exec('pwd', array($callbackObject, 'callbackMethod')); + $ssh->exec('pwd', [$callbackObject, 'callbackMethod']); return $ssh; } diff --git a/tests/PhpseclibTestCase.php b/tests/PhpseclibTestCase.php index ec3dc885..1cb3ce8a 100644 --- a/tests/PhpseclibTestCase.php +++ b/tests/PhpseclibTestCase.php @@ -7,7 +7,7 @@ abstract class PhpseclibTestCase extends PHPUnit_Framework_TestCase { - protected $tempFilesToUnlinkOnTearDown = array(); + protected $tempFilesToUnlinkOnTearDown = []; public function tearDown() { @@ -110,7 +110,7 @@ abstract class PhpseclibTestCase extends PHPUnit_Framework_TestCase return $prop->getValue($obj); } - public static function callFunc($obj, $func, $params = array()) + public static function callFunc($obj, $func, $params = []) { $reflection = new ReflectionClass(get_class($obj)); $method = $reflection->getMethod($func); diff --git a/tests/Unit/Crypt/AES/TestCase.php b/tests/Unit/Crypt/AES/TestCase.php index 09458fd3..6ebfc34d 100644 --- a/tests/Unit/Crypt/AES/TestCase.php +++ b/tests/Unit/Crypt/AES/TestCase.php @@ -27,35 +27,35 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase */ public function continuousBufferCombos() { - $modes = array( + $modes = [ 'ctr', 'ofb', 'cfb', 'cfb8' - ); - $plaintexts = array( + ]; + $plaintexts = [ '', '12345678901234567', // https://github.com/phpseclib/phpseclib/issues/39 "\xDE\xAD\xBE\xAF", ':-):-):-):-):-):-)', // https://github.com/phpseclib/phpseclib/pull/43 - ); - $ivs = array( + ]; + $ivs = [ str_repeat("\0", 16), str_pad('test123', 16, "\0"), - ); - $keys = array( + ]; + $keys = [ str_repeat("\0", 16), str_pad(':-8', 16, "\0"), // https://github.com/phpseclib/phpseclib/pull/43 str_pad('FOOBARZ', 16, "\0"), - ); + ]; - $result = array(); + $result = []; foreach ($modes as $mode) { foreach ($plaintexts as $plaintext) { foreach ($ivs as $iv) { foreach ($keys as $key) { - $result[] = array($mode, $plaintext, $iv, $key); + $result[] = [$mode, $plaintext, $iv, $key]; } } } @@ -128,36 +128,36 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase */ public function continuousBufferBatteryCombos() { - $modes = array( + $modes = [ 'ctr', 'ofb', 'cfb', 'cfb8', - ); + ]; - $combos = array( - array(16), - array(17), - array(1, 16), - array(3, 6, 7), // (3 to test the openssl_encrypt call and the buffer creation, 6 to test the exclusive use of the buffer and 7 to test the buffer's exhaustion and recreation) - array(15, 4), // (15 to test openssl_encrypt call and buffer creation and 4 to test something that spans multpile bloc - array(3, 6, 10, 16), // this is why the strlen check in the buffer-only code was needed - array(16, 16), // two full size blocks - array(3, 6, 7, 16), // partial block + full size block - array(16, 3, 6, 7), + $combos = [ + [16], + [17], + [1, 16], + [3, 6, 7], // (3 to test the openssl_encrypt call and the buffer creation, 6 to test the exclusive use of the buffer and 7 to test the buffer's exhaustion and recreation) + [15, 4], // (15 to test openssl_encrypt call and buffer creation and 4 to test something that spans multpile bloc + [3, 6, 10, 16], // this is why the strlen check in the buffer-only code was needed + [16, 16], // two full size blocks + [3, 6, 7, 16], // partial block + full size block + [16, 3, 6, 7], // a few others just for fun - array(32,32), - array(31,31), - array(17,17), - array(99, 99) - ); + [32,32], + [31,31], + [17,17], + [99, 99] + ]; - $result = array(); + $result = []; foreach ($modes as $mode) { foreach ($combos as $combo) { - foreach (array('encrypt', 'decrypt') as $op) { - $result[] = array($op, $mode, $combo); + foreach (['encrypt', 'decrypt'] as $op) { + $result[] = [$op, $mode, $combo]; } } } diff --git a/tests/Unit/Crypt/BlowfishTest.php b/tests/Unit/Crypt/BlowfishTest.php index e7e97354..ce1fe725 100644 --- a/tests/Unit/Crypt/BlowfishTest.php +++ b/tests/Unit/Crypt/BlowfishTest.php @@ -12,57 +12,57 @@ class Unit_Crypt_BlowfishTest extends PhpseclibTestCase { public function engineVectors() { - $engines = array( + $engines = [ 'PHP', 'Eval', 'mcrypt', 'OpenSSL', - ); + ]; // tests from https://www.schneier.com/code/vectors.txt - $tests = array( + $tests = [ // key, plaintext, ciphertext - array(pack('H*', '0000000000000000'), pack('H*', '0000000000000000'), pack('H*', '4EF997456198DD78')), - array(pack('H*', 'FFFFFFFFFFFFFFFF'), pack('H*', 'FFFFFFFFFFFFFFFF'), pack('H*', '51866FD5B85ECB8A')), - array(pack('H*', '3000000000000000'), pack('H*', '1000000000000001'), pack('H*', '7D856F9A613063F2')), - array(pack('H*', '1111111111111111'), pack('H*', '1111111111111111'), pack('H*', '2466DD878B963C9D')), - array(pack('H*', '0123456789ABCDEF'), pack('H*', '1111111111111111'), pack('H*', '61F9C3802281B096')), - array(pack('H*', '1111111111111111'), pack('H*', '0123456789ABCDEF'), pack('H*', '7D0CC630AFDA1EC7')), - array(pack('H*', '0000000000000000'), pack('H*', '0000000000000000'), pack('H*', '4EF997456198DD78')), - array(pack('H*', 'FEDCBA9876543210'), pack('H*', '0123456789ABCDEF'), pack('H*', '0ACEAB0FC6A0A28D')), - array(pack('H*', '7CA110454A1A6E57'), pack('H*', '01A1D6D039776742'), pack('H*', '59C68245EB05282B')), - array(pack('H*', '0131D9619DC1376E'), pack('H*', '5CD54CA83DEF57DA'), pack('H*', 'B1B8CC0B250F09A0')), - array(pack('H*', '07A1133E4A0B2686'), pack('H*', '0248D43806F67172'), pack('H*', '1730E5778BEA1DA4')), - array(pack('H*', '3849674C2602319E'), pack('H*', '51454B582DDF440A'), pack('H*', 'A25E7856CF2651EB')), - array(pack('H*', '04B915BA43FEB5B6'), pack('H*', '42FD443059577FA2'), pack('H*', '353882B109CE8F1A')), - array(pack('H*', '0113B970FD34F2CE'), pack('H*', '059B5E0851CF143A'), pack('H*', '48F4D0884C379918')), - array(pack('H*', '0170F175468FB5E6'), pack('H*', '0756D8E0774761D2'), pack('H*', '432193B78951FC98')), - array(pack('H*', '43297FAD38E373FE'), pack('H*', '762514B829BF486A'), pack('H*', '13F04154D69D1AE5')), - array(pack('H*', '07A7137045DA2A16'), pack('H*', '3BDD119049372802'), pack('H*', '2EEDDA93FFD39C79')), - array(pack('H*', '04689104C2FD3B2F'), pack('H*', '26955F6835AF609A'), pack('H*', 'D887E0393C2DA6E3')), - array(pack('H*', '37D06BB516CB7546'), pack('H*', '164D5E404F275232'), pack('H*', '5F99D04F5B163969')), - array(pack('H*', '1F08260D1AC2465E'), pack('H*', '6B056E18759F5CCA'), pack('H*', '4A057A3B24D3977B')), - array(pack('H*', '584023641ABA6176'), pack('H*', '004BD6EF09176062'), pack('H*', '452031C1E4FADA8E')), - array(pack('H*', '025816164629B007'), pack('H*', '480D39006EE762F2'), pack('H*', '7555AE39F59B87BD')), - array(pack('H*', '49793EBC79B3258F'), pack('H*', '437540C8698F3CFA'), pack('H*', '53C55F9CB49FC019')), - array(pack('H*', '4FB05E1515AB73A7'), pack('H*', '072D43A077075292'), pack('H*', '7A8E7BFA937E89A3')), - array(pack('H*', '49E95D6D4CA229BF'), pack('H*', '02FE55778117F12A'), pack('H*', 'CF9C5D7A4986ADB5')), - array(pack('H*', '018310DC409B26D6'), pack('H*', '1D9D5C5018F728C2'), pack('H*', 'D1ABB290658BC778')), - array(pack('H*', '1C587F1C13924FEF'), pack('H*', '305532286D6F295A'), pack('H*', '55CB3774D13EF201')), - array(pack('H*', '0101010101010101'), pack('H*', '0123456789ABCDEF'), pack('H*', 'FA34EC4847B268B2')), - array(pack('H*', '1F1F1F1F0E0E0E0E'), pack('H*', '0123456789ABCDEF'), pack('H*', 'A790795108EA3CAE')), - array(pack('H*', 'E0FEE0FEF1FEF1FE'), pack('H*', '0123456789ABCDEF'), pack('H*', 'C39E072D9FAC631D')), - array(pack('H*', '0000000000000000'), pack('H*', 'FFFFFFFFFFFFFFFF'), pack('H*', '014933E0CDAFF6E4')), - array(pack('H*', 'FFFFFFFFFFFFFFFF'), pack('H*', '0000000000000000'), pack('H*', 'F21E9A77B71C49BC')), - array(pack('H*', '0123456789ABCDEF'), pack('H*', '0000000000000000'), pack('H*', '245946885754369A')), - array(pack('H*', 'FEDCBA9876543210'), pack('H*', 'FFFFFFFFFFFFFFFF'), pack('H*', '6B5C5A9C5D9E0A5A')) - ); + [pack('H*', '0000000000000000'), pack('H*', '0000000000000000'), pack('H*', '4EF997456198DD78')], + [pack('H*', 'FFFFFFFFFFFFFFFF'), pack('H*', 'FFFFFFFFFFFFFFFF'), pack('H*', '51866FD5B85ECB8A')], + [pack('H*', '3000000000000000'), pack('H*', '1000000000000001'), pack('H*', '7D856F9A613063F2')], + [pack('H*', '1111111111111111'), pack('H*', '1111111111111111'), pack('H*', '2466DD878B963C9D')], + [pack('H*', '0123456789ABCDEF'), pack('H*', '1111111111111111'), pack('H*', '61F9C3802281B096')], + [pack('H*', '1111111111111111'), pack('H*', '0123456789ABCDEF'), pack('H*', '7D0CC630AFDA1EC7')], + [pack('H*', '0000000000000000'), pack('H*', '0000000000000000'), pack('H*', '4EF997456198DD78')], + [pack('H*', 'FEDCBA9876543210'), pack('H*', '0123456789ABCDEF'), pack('H*', '0ACEAB0FC6A0A28D')], + [pack('H*', '7CA110454A1A6E57'), pack('H*', '01A1D6D039776742'), pack('H*', '59C68245EB05282B')], + [pack('H*', '0131D9619DC1376E'), pack('H*', '5CD54CA83DEF57DA'), pack('H*', 'B1B8CC0B250F09A0')], + [pack('H*', '07A1133E4A0B2686'), pack('H*', '0248D43806F67172'), pack('H*', '1730E5778BEA1DA4')], + [pack('H*', '3849674C2602319E'), pack('H*', '51454B582DDF440A'), pack('H*', 'A25E7856CF2651EB')], + [pack('H*', '04B915BA43FEB5B6'), pack('H*', '42FD443059577FA2'), pack('H*', '353882B109CE8F1A')], + [pack('H*', '0113B970FD34F2CE'), pack('H*', '059B5E0851CF143A'), pack('H*', '48F4D0884C379918')], + [pack('H*', '0170F175468FB5E6'), pack('H*', '0756D8E0774761D2'), pack('H*', '432193B78951FC98')], + [pack('H*', '43297FAD38E373FE'), pack('H*', '762514B829BF486A'), pack('H*', '13F04154D69D1AE5')], + [pack('H*', '07A7137045DA2A16'), pack('H*', '3BDD119049372802'), pack('H*', '2EEDDA93FFD39C79')], + [pack('H*', '04689104C2FD3B2F'), pack('H*', '26955F6835AF609A'), pack('H*', 'D887E0393C2DA6E3')], + [pack('H*', '37D06BB516CB7546'), pack('H*', '164D5E404F275232'), pack('H*', '5F99D04F5B163969')], + [pack('H*', '1F08260D1AC2465E'), pack('H*', '6B056E18759F5CCA'), pack('H*', '4A057A3B24D3977B')], + [pack('H*', '584023641ABA6176'), pack('H*', '004BD6EF09176062'), pack('H*', '452031C1E4FADA8E')], + [pack('H*', '025816164629B007'), pack('H*', '480D39006EE762F2'), pack('H*', '7555AE39F59B87BD')], + [pack('H*', '49793EBC79B3258F'), pack('H*', '437540C8698F3CFA'), pack('H*', '53C55F9CB49FC019')], + [pack('H*', '4FB05E1515AB73A7'), pack('H*', '072D43A077075292'), pack('H*', '7A8E7BFA937E89A3')], + [pack('H*', '49E95D6D4CA229BF'), pack('H*', '02FE55778117F12A'), pack('H*', 'CF9C5D7A4986ADB5')], + [pack('H*', '018310DC409B26D6'), pack('H*', '1D9D5C5018F728C2'), pack('H*', 'D1ABB290658BC778')], + [pack('H*', '1C587F1C13924FEF'), pack('H*', '305532286D6F295A'), pack('H*', '55CB3774D13EF201')], + [pack('H*', '0101010101010101'), pack('H*', '0123456789ABCDEF'), pack('H*', 'FA34EC4847B268B2')], + [pack('H*', '1F1F1F1F0E0E0E0E'), pack('H*', '0123456789ABCDEF'), pack('H*', 'A790795108EA3CAE')], + [pack('H*', 'E0FEE0FEF1FEF1FE'), pack('H*', '0123456789ABCDEF'), pack('H*', 'C39E072D9FAC631D')], + [pack('H*', '0000000000000000'), pack('H*', 'FFFFFFFFFFFFFFFF'), pack('H*', '014933E0CDAFF6E4')], + [pack('H*', 'FFFFFFFFFFFFFFFF'), pack('H*', '0000000000000000'), pack('H*', 'F21E9A77B71C49BC')], + [pack('H*', '0123456789ABCDEF'), pack('H*', '0000000000000000'), pack('H*', '245946885754369A')], + [pack('H*', 'FEDCBA9876543210'), pack('H*', 'FFFFFFFFFFFFFFFF'), pack('H*', '6B5C5A9C5D9E0A5A')] + ]; - $result = array(); + $result = []; foreach ($engines as $engine) { foreach ($tests as $test) { - $result[] = array($engine, $test[0], $test[1], $test[2]); + $result[] = [$engine, $test[0], $test[1], $test[2]]; } } @@ -90,7 +90,7 @@ class Unit_Crypt_BlowfishTest extends PhpseclibTestCase public function testKeySizes() { - $objects = $engines = array(); + $objects = $engines = []; $temp = new Blowfish('ctr'); $temp->setPreferredEngine('PHP'); $objects[] = $temp; diff --git a/tests/Unit/Crypt/HashTest.php b/tests/Unit/Crypt/HashTest.php index 1d45c08b..de1e0f4a 100644 --- a/tests/Unit/Crypt/HashTest.php +++ b/tests/Unit/Crypt/HashTest.php @@ -39,86 +39,86 @@ class Unit_Crypt_HashTest extends PhpseclibTestCase public static function hashData() { - return array( - array('md5', '', 'd41d8cd98f00b204e9800998ecf8427e'), - array('md5', 'The quick brown fox jumps over the lazy dog', '9e107d9d372bb6826bd81d3542a419d6'), - array('md5', 'The quick brown fox jumps over the lazy dog.', 'e4d909c290d0fb1ca068ffaddf22cbd0'), - array('sha1', 'The quick brown fox jumps over the lazy dog', '2fd4e1c67a2d28fced849ee1bb76e7391b93eb12'), - array('sha1', 'The quick brown fox jumps over the lazy dog.', '408d94384216f890ff7a0c3528e8bed1e0b01621'), - array( + return [ + ['md5', '', 'd41d8cd98f00b204e9800998ecf8427e'], + ['md5', 'The quick brown fox jumps over the lazy dog', '9e107d9d372bb6826bd81d3542a419d6'], + ['md5', 'The quick brown fox jumps over the lazy dog.', 'e4d909c290d0fb1ca068ffaddf22cbd0'], + ['sha1', 'The quick brown fox jumps over the lazy dog', '2fd4e1c67a2d28fced849ee1bb76e7391b93eb12'], + ['sha1', 'The quick brown fox jumps over the lazy dog.', '408d94384216f890ff7a0c3528e8bed1e0b01621'], + [ 'sha256', '', 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' - ), - array( + ], + [ 'sha256', 'The quick brown fox jumps over the lazy dog', 'd7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592', - ), - array( + ], + [ 'sha256', 'The quick brown fox jumps over the lazy dog.', 'ef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6c', - ), - array( + ], + [ 'sha384', '', '38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b' - ), - array( + ], + [ 'sha384', 'The quick brown fox jumps over the lazy dog', 'ca737f1014a48f4c0b6dd43cb177b0afd9e5169367544c494011e3317dbf9a509cb1e5dc1e85a941bbee3d7f2afbc9b1', - ), - array( + ], + [ 'sha512', '', 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e' - ), - array( + ], + [ 'sha512', 'The quick brown fox jumps over the lazy dog', '07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6', - ), - array( + ], + [ 'sha512', 'The quick brown fox jumps over the lazy dog.', '91ea1245f20d46ae9a037a989f54f1f790f0a47607eeb8a14d12890cea77a1bbc6c7ed9cf205e67b7f2b8fd4c7dfd3a7a8617e45f3c463d481c7e586c39ac1ed', - ), + ], // from http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA512_224.pdf - array( + [ 'sha512/224', 'abc', '4634270f707b6a54daae7530460842e20e37ed265ceee9a43e8924aa' - ), - array( + ], + [ 'sha512/224', 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu', '23fec5bb94d60b23308192640b0c453335d664734fe40e7268674af9' - ), + ], // from http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA512_256.pdf - array( + [ 'sha512/256', 'abc', '53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23' - ), - array( + ], + [ 'sha512/256', 'abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu', '3928e184fb8690f840da3988121d31be65cb9d3ef83ee6146feac861e19b563a' - ), + ], // from http://csrc.nist.gov/groups/ST/toolkit/documents/Examples/SHA224.pdf - array( + [ 'sha224', 'abc', '23097D223405D8228642A477BDA255B32AADBCE4BDA0B3F7E36C9DA7' - ), - array( + ], + [ 'sha224', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', '75388B16512776CC5DBA5DA1FD890150B0C6455CB4F58B1952522525' - ), - ); + ], + ]; } /** @@ -139,187 +139,187 @@ class Unit_Crypt_HashTest extends PhpseclibTestCase public static function hmacData() { - return array( - array('md5', '', '', '74e6f7298a9c2d168935f58c001bad88'), - array('md5', 'key', 'The quick brown fox jumps over the lazy dog', '80070713463e7749b90c2dc24911e275'), + return [ + ['md5', '', '', '74e6f7298a9c2d168935f58c001bad88'], + ['md5', 'key', 'The quick brown fox jumps over the lazy dog', '80070713463e7749b90c2dc24911e275'], // from https://tools.ietf.org/rfc/rfc4231.txt // test case 1 - array( + [ 'sha224', str_repeat("\x0b", 20), 'Hi There', '896fb1128abbdf196832107cd49df33f47b4b1169912ba4f53684b22', - ), + ], // test case 2 - array( + [ 'sha224', 'Jefe', 'what do ya want for nothing?', 'a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44', - ), + ], // test case 3 - array( + [ 'sha224', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), pack('H*', 'dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'), '7fb3cb3588c6c1f6ffa9694d7d6ad2649365b0c1f65d69d1ec8333ea', - ), + ], // test case 4 - array( + [ 'sha224', pack('H*', '0102030405060708090a0b0c0d0e0f10111213141516171819'), pack('H*', 'cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd'), '6c11506874013cac6a2abc1bb382627cec6a90d86efc012de7afec5a', - ), + ], // skip test case 5; truncation is only supported to 96 bits (eg. sha1-96) and that's already unit tested // test case 6 - array( + [ 'sha224', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), 'Test Using Larger Than Block-Size Key - Hash Key First', '95e9a0db962095adaebe9b2d6f0dbce2d499f112f2d2b7273fa6870e', - ), + ], // test case 7 - array( + [ 'sha224', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), 'This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.', '3a854166ac5d9f023f54d517d0b39dbd946770db9c2b95c9f6f565d1' - ), + ], // test case 1 - array( + [ 'sha256', str_repeat("\x0b", 20), 'Hi There', 'b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7', - ), + ], // test case 2 - array( + [ 'sha256', 'Jefe', 'what do ya want for nothing?', '5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843', - ), + ], // test case 3 - array( + [ 'sha256', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), pack('H*', 'dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'), '773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe', - ), + ], // test case 4 - array( + [ 'sha256', pack('H*', '0102030405060708090a0b0c0d0e0f10111213141516171819'), pack('H*', 'cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd'), '82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b', - ), + ], // skip test case 5; truncation is only supported to 96 bits (eg. sha1-96) and that's already unit tested // test case 6 - array( + [ 'sha256', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), 'Test Using Larger Than Block-Size Key - Hash Key First', '60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54', - ), + ], // test case 7 - array( + [ 'sha256', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), 'This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.', '9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2' - ), + ], // test case 1 - array( + [ 'sha384', str_repeat("\x0b", 20), 'Hi There', 'afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6', - ), + ], // test case 2 - array( + [ 'sha384', 'Jefe', 'what do ya want for nothing?', 'af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649', - ), + ], // test case 3 - array( + [ 'sha384', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), pack('H*', 'dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'), '88062608d3e6ad8a0aa2ace014c8a86f0aa635d947ac9febe83ef4e55966144b2a5ab39dc13814b94e3ab6e101a34f27', - ), + ], // test case 4 - array( + [ 'sha384', pack('H*', '0102030405060708090a0b0c0d0e0f10111213141516171819'), pack('H*', 'cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd'), '3e8a69b7783c25851933ab6290af6ca77a9981480850009cc5577c6e1f573b4e6801dd23c4a7d679ccf8a386c674cffb', - ), + ], // skip test case 5; truncation is only supported to 96 bits (eg. sha1-96) and that's already unit tested // test case 6 - array( + [ 'sha384', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), 'Test Using Larger Than Block-Size Key - Hash Key First', '4ece084485813e9088d2c63a041bc5b44f9ef1012a2b588f3cd11f05033ac4c60c2ef6ab4030fe8296248df163f44952', - ), + ], // test case 7 - array( + [ 'sha384', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), 'This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.', '6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523e' - ), + ], // test case 1 - array( + [ 'sha512', str_repeat("\x0b", 20), 'Hi There', '87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854', - ), + ], // test case 2 - array( + [ 'sha512', 'Jefe', 'what do ya want for nothing?', '164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737', - ), + ], // test case 3 - array( + [ 'sha512', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), pack('H*', 'dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'), 'fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fb', - ), + ], // test case 4 - array( + [ 'sha512', pack('H*', '0102030405060708090a0b0c0d0e0f10111213141516171819'), pack('H*', 'cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd'), 'b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd', - ), + ], // skip test case 5; truncation is only supported to 96 bits (eg. sha1-96) and that's already unit tested // test case 6 - array( + [ 'sha512', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), 'Test Using Larger Than Block-Size Key - Hash Key First', '80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598', - ), + ], // test case 7 - array( + [ 'sha512', pack('H*', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'), 'This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.', 'e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58' - ), - ); + ], + ]; } /** @@ -380,14 +380,14 @@ class Unit_Crypt_HashTest extends PhpseclibTestCase public function lengths() { - return array( + return [ // known - array('md5-96', 12), - array('md5', 16), - array('sha1', 20), - array('sha256', 32), - array('sha384', 48), - array('sha512', 64), - ); + ['md5-96', 12], + ['md5', 16], + ['sha1', 20], + ['sha256', 32], + ['sha384', 48], + ['sha512', 64], + ]; } } diff --git a/tests/Unit/Crypt/RC2Test.php b/tests/Unit/Crypt/RC2Test.php index 143aa969..799d7201 100644 --- a/tests/Unit/Crypt/RC2Test.php +++ b/tests/Unit/Crypt/RC2Test.php @@ -9,33 +9,33 @@ use phpseclib\Crypt\RC2; class Unit_Crypt_RC2Test extends PhpseclibTestCase { - var $engines = array( + var $engines = [ 'PHP', 'Eval', 'mcrypt', 'OpenSSL', - ); + ]; public function engineVectors() { // tests from https://tools.ietf.org/html/rfc2268#page-8 - $tests = array( + $tests = [ // key, effective key length, plaintext, ciphertext - array('0000000000000000', 63, '0000000000000000', 'ebb773f993278eff'), - array('ffffffffffffffff', 64, 'ffffffffffffffff', '278b27e42e2f0d49'), - array('3000000000000000', 64, '1000000000000001', '30649edf9be7d2c2'), - array('88', 64, '0000000000000000', '61a8a244adacccf0'), - array('88bca90e90875a', 64, '0000000000000000', '6ccf4308974c267f'), - array('88bca90e90875a7f0f79c384627bafb2', 64, '0000000000000000', '1a807d272bbe5db1'), - array('88bca90e90875a7f0f79c384627bafb2', 128, '0000000000000000', '2269552ab0f85ca6'), - array('88bca90e90875a7f0f79c384627bafb216f80a6f85920584c42fceb0be255daf1e', 129, '0000000000000000', '5b78d3a43dfff1f1') - ); + ['0000000000000000', 63, '0000000000000000', 'ebb773f993278eff'], + ['ffffffffffffffff', 64, 'ffffffffffffffff', '278b27e42e2f0d49'], + ['3000000000000000', 64, '1000000000000001', '30649edf9be7d2c2'], + ['88', 64, '0000000000000000', '61a8a244adacccf0'], + ['88bca90e90875a', 64, '0000000000000000', '6ccf4308974c267f'], + ['88bca90e90875a7f0f79c384627bafb2', 64, '0000000000000000', '1a807d272bbe5db1'], + ['88bca90e90875a7f0f79c384627bafb2', 128, '0000000000000000', '2269552ab0f85ca6'], + ['88bca90e90875a7f0f79c384627bafb216f80a6f85920584c42fceb0be255daf1e', 129, '0000000000000000', '5b78d3a43dfff1f1'] + ]; - $result = array(); + $result = []; foreach ($this->engines as $engine) { foreach ($tests as $test) { - $result[] = array($engine, $test[0], $test[1], $test[2], $test[3]); + $result[] = [$engine, $test[0], $test[1], $test[2], $test[3]]; } } diff --git a/tests/Unit/Crypt/RC4Test.php b/tests/Unit/Crypt/RC4Test.php index 872b6a48..762ac91b 100644 --- a/tests/Unit/Crypt/RC4Test.php +++ b/tests/Unit/Crypt/RC4Test.php @@ -12,183 +12,183 @@ class Unit_Crypt_RC4Test extends PhpseclibTestCase { public function engineVectors() { - $engines = array( + $engines = [ 'PHP', 'Eval', 'mcrypt', 'OpenSSL', - ); + ]; // tests from https://tools.ietf.org/html/rfc6229 - $tests = array( - array( + $tests = [ + [ 'key' => pack('H*', '0102030405'), // 40-bit key - 'output' => array( - array('offset' => 0, 'result' => 'b2396305f03dc027ccc3524a0a1118a8'), - array('offset' => 16, 'result' => '6982944f18fc82d589c403a47a0d0919'), - array('offset' => 240, 'result' => '28cb1132c96ce286421dcaadb8b69eae'), - array('offset' => 256, 'result' => '1cfcf62b03eddb641d77dfcf7f8d8c93'), - array('offset' => 496, 'result' => '42b7d0cdd918a8a33dd51781c81f4041'), - array('offset' => 512, 'result' => '6459844432a7da923cfb3eb4980661f6'), - array('offset' => 752, 'result' => 'ec10327bde2beefd18f9277680457e22'), - array('offset' => 768, 'result' => 'eb62638d4f0ba1fe9fca20e05bf8ff2b'), - array('offset' => 1008, 'result' => '45129048e6a0ed0b56b490338f078da5'), - array('offset' => 1024, 'result' => '30abbcc7c20b01609f23ee2d5f6bb7df'), - array('offset' => 1520, 'result' => '3294f744d8f9790507e70f62e5bbceea'), - array('offset' => 1536, 'result' => 'd8729db41882259bee4f825325f5a130'), - array('offset' => 2032, 'result' => '1eb14a0c13b3bf47fa2a0ba93ad45b8b'), - array('offset' => 2048, 'result' => 'cc582f8ba9f265e2b1be9112e975d2d7'), - array('offset' => 3056, 'result' => 'f2e30f9bd102ecbf75aaade9bc35c43c'), - array('offset' => 3072, 'result' => 'ec0e11c479dc329dc8da7968fe965681'), - array('offset' => 4080, 'result' => '068326a2118416d21f9d04b2cd1ca050'), - array('offset' => 4096, 'result' => 'ff25b58995996707e51fbdf08b34d875') - ) - ), - array( + 'output' => [ + ['offset' => 0, 'result' => 'b2396305f03dc027ccc3524a0a1118a8'], + ['offset' => 16, 'result' => '6982944f18fc82d589c403a47a0d0919'], + ['offset' => 240, 'result' => '28cb1132c96ce286421dcaadb8b69eae'], + ['offset' => 256, 'result' => '1cfcf62b03eddb641d77dfcf7f8d8c93'], + ['offset' => 496, 'result' => '42b7d0cdd918a8a33dd51781c81f4041'], + ['offset' => 512, 'result' => '6459844432a7da923cfb3eb4980661f6'], + ['offset' => 752, 'result' => 'ec10327bde2beefd18f9277680457e22'], + ['offset' => 768, 'result' => 'eb62638d4f0ba1fe9fca20e05bf8ff2b'], + ['offset' => 1008, 'result' => '45129048e6a0ed0b56b490338f078da5'], + ['offset' => 1024, 'result' => '30abbcc7c20b01609f23ee2d5f6bb7df'], + ['offset' => 1520, 'result' => '3294f744d8f9790507e70f62e5bbceea'], + ['offset' => 1536, 'result' => 'd8729db41882259bee4f825325f5a130'], + ['offset' => 2032, 'result' => '1eb14a0c13b3bf47fa2a0ba93ad45b8b'], + ['offset' => 2048, 'result' => 'cc582f8ba9f265e2b1be9112e975d2d7'], + ['offset' => 3056, 'result' => 'f2e30f9bd102ecbf75aaade9bc35c43c'], + ['offset' => 3072, 'result' => 'ec0e11c479dc329dc8da7968fe965681'], + ['offset' => 4080, 'result' => '068326a2118416d21f9d04b2cd1ca050'], + ['offset' => 4096, 'result' => 'ff25b58995996707e51fbdf08b34d875'] + ] + ], + [ 'key' => pack('H*', '01020304050607'), // 56-bit key - 'output' => array( - array('offset' => 0, 'result' => '293f02d47f37c9b633f2af5285feb46b'), - array('offset' => 16, 'result' => 'e620f1390d19bd84e2e0fd752031afc1'), - array('offset' => 240, 'result' => '914f02531c9218810df60f67e338154c'), - array('offset' => 256, 'result' => 'd0fdb583073ce85ab83917740ec011d5'), - array('offset' => 496, 'result' => '75f81411e871cffa70b90c74c592e454'), - array('offset' => 512, 'result' => '0bb87202938dad609e87a5a1b079e5e4'), - array('offset' => 752, 'result' => 'c2911246b612e7e7b903dfeda1dad866'), - array('offset' => 768, 'result' => '32828f91502b6291368de8081de36fc2'), - array('offset' => 1008, 'result' => 'f3b9a7e3b297bf9ad804512f9063eff1'), - array('offset' => 1024, 'result' => '8ecb67a9ba1f55a5a067e2b026a3676f'), - array('offset' => 1520, 'result' => 'd2aa902bd42d0d7cfd340cd45810529f'), - array('offset' => 1536, 'result' => '78b272c96e42eab4c60bd914e39d06e3'), - array('offset' => 2032, 'result' => 'f4332fd31a079396ee3cee3f2a4ff049'), - array('offset' => 2048, 'result' => '05459781d41fda7f30c1be7e1246c623'), - array('offset' => 3056, 'result' => 'adfd3868b8e51485d5e610017e3dd609'), - array('offset' => 3072, 'result' => 'ad26581c0c5be45f4cea01db2f3805d5'), - array('offset' => 4080, 'result' => 'f3172ceffc3b3d997c85ccd5af1a950c'), - array('offset' => 4096, 'result' => 'e74b0b9731227fd37c0ec08a47ddd8b8') - ) - ), - array( + 'output' => [ + ['offset' => 0, 'result' => '293f02d47f37c9b633f2af5285feb46b'], + ['offset' => 16, 'result' => 'e620f1390d19bd84e2e0fd752031afc1'], + ['offset' => 240, 'result' => '914f02531c9218810df60f67e338154c'], + ['offset' => 256, 'result' => 'd0fdb583073ce85ab83917740ec011d5'], + ['offset' => 496, 'result' => '75f81411e871cffa70b90c74c592e454'], + ['offset' => 512, 'result' => '0bb87202938dad609e87a5a1b079e5e4'], + ['offset' => 752, 'result' => 'c2911246b612e7e7b903dfeda1dad866'], + ['offset' => 768, 'result' => '32828f91502b6291368de8081de36fc2'], + ['offset' => 1008, 'result' => 'f3b9a7e3b297bf9ad804512f9063eff1'], + ['offset' => 1024, 'result' => '8ecb67a9ba1f55a5a067e2b026a3676f'], + ['offset' => 1520, 'result' => 'd2aa902bd42d0d7cfd340cd45810529f'], + ['offset' => 1536, 'result' => '78b272c96e42eab4c60bd914e39d06e3'], + ['offset' => 2032, 'result' => 'f4332fd31a079396ee3cee3f2a4ff049'], + ['offset' => 2048, 'result' => '05459781d41fda7f30c1be7e1246c623'], + ['offset' => 3056, 'result' => 'adfd3868b8e51485d5e610017e3dd609'], + ['offset' => 3072, 'result' => 'ad26581c0c5be45f4cea01db2f3805d5'], + ['offset' => 4080, 'result' => 'f3172ceffc3b3d997c85ccd5af1a950c'], + ['offset' => 4096, 'result' => 'e74b0b9731227fd37c0ec08a47ddd8b8'] + ] + ], + [ 'key' => pack('H*', '0102030405060708'), // 64-bit key - 'output' => array( - array('offset' => 0, 'result' => '97ab8a1bf0afb96132f2f67258da15a8'), - array('offset' => 16, 'result' => '8263efdb45c4a18684ef87e6b19e5b09'), - array('offset' => 240, 'result' => '9636ebc9841926f4f7d1f362bddf6e18'), - array('offset' => 256, 'result' => 'd0a990ff2c05fef5b90373c9ff4b870a'), - array('offset' => 496, 'result' => '73239f1db7f41d80b643c0c52518ec63'), - array('offset' => 512, 'result' => '163b319923a6bdb4527c626126703c0f'), - array('offset' => 752, 'result' => '49d6c8af0f97144a87df21d91472f966'), - array('offset' => 768, 'result' => '44173a103b6616c5d5ad1cee40c863d0'), - array('offset' => 1008, 'result' => '273c9c4b27f322e4e716ef53a47de7a4'), - array('offset' => 1024, 'result' => 'c6d0e7b226259fa9023490b26167ad1d'), - array('offset' => 1520, 'result' => '1fe8986713f07c3d9ae1c163ff8cf9d3'), - array('offset' => 1536, 'result' => '8369e1a965610be887fbd0c79162aafb'), - array('offset' => 2032, 'result' => '0a0127abb44484b9fbef5abcae1b579f'), - array('offset' => 2048, 'result' => 'c2cdadc6402e8ee866e1f37bdb47e42c'), - array('offset' => 3056, 'result' => '26b51ea37df8e1d6f76fc3b66a7429b3'), - array('offset' => 3072, 'result' => 'bc7683205d4f443dc1f29dda3315c87b'), - array('offset' => 4080, 'result' => 'd5fa5a3469d29aaaf83d23589db8c85b'), - array('offset' => 4096, 'result' => '3fb46e2c8f0f068edce8cdcd7dfc5862') - ) - ), - array( + 'output' => [ + ['offset' => 0, 'result' => '97ab8a1bf0afb96132f2f67258da15a8'], + ['offset' => 16, 'result' => '8263efdb45c4a18684ef87e6b19e5b09'], + ['offset' => 240, 'result' => '9636ebc9841926f4f7d1f362bddf6e18'], + ['offset' => 256, 'result' => 'd0a990ff2c05fef5b90373c9ff4b870a'], + ['offset' => 496, 'result' => '73239f1db7f41d80b643c0c52518ec63'], + ['offset' => 512, 'result' => '163b319923a6bdb4527c626126703c0f'], + ['offset' => 752, 'result' => '49d6c8af0f97144a87df21d91472f966'], + ['offset' => 768, 'result' => '44173a103b6616c5d5ad1cee40c863d0'], + ['offset' => 1008, 'result' => '273c9c4b27f322e4e716ef53a47de7a4'], + ['offset' => 1024, 'result' => 'c6d0e7b226259fa9023490b26167ad1d'], + ['offset' => 1520, 'result' => '1fe8986713f07c3d9ae1c163ff8cf9d3'], + ['offset' => 1536, 'result' => '8369e1a965610be887fbd0c79162aafb'], + ['offset' => 2032, 'result' => '0a0127abb44484b9fbef5abcae1b579f'], + ['offset' => 2048, 'result' => 'c2cdadc6402e8ee866e1f37bdb47e42c'], + ['offset' => 3056, 'result' => '26b51ea37df8e1d6f76fc3b66a7429b3'], + ['offset' => 3072, 'result' => 'bc7683205d4f443dc1f29dda3315c87b'], + ['offset' => 4080, 'result' => 'd5fa5a3469d29aaaf83d23589db8c85b'], + ['offset' => 4096, 'result' => '3fb46e2c8f0f068edce8cdcd7dfc5862'] + ] + ], + [ 'key' => pack('H*', '0102030405060708090a'), // 80-bit key - 'output' => array( - array('offset' => 0, 'result' => 'ede3b04643e586cc907dc21851709902'), - array('offset' => 16, 'result' => '03516ba78f413beb223aa5d4d2df6711'), - array('offset' => 240, 'result' => '3cfd6cb58ee0fdde640176ad0000044d'), - array('offset' => 256, 'result' => '48532b21fb6079c9114c0ffd9c04a1ad'), - array('offset' => 496, 'result' => '3e8cea98017109979084b1ef92f99d86'), - array('offset' => 512, 'result' => 'e20fb49bdb337ee48b8d8dc0f4afeffe'), - array('offset' => 752, 'result' => '5c2521eacd7966f15e056544bea0d315'), - array('offset' => 768, 'result' => 'e067a7031931a246a6c3875d2f678acb'), - array('offset' => 1008, 'result' => 'a64f70af88ae56b6f87581c0e23e6b08'), - array('offset' => 1024, 'result' => 'f449031de312814ec6f319291f4a0516'), - array('offset' => 1520, 'result' => 'bdae85924b3cb1d0a2e33a30c6d79599'), - array('offset' => 1536, 'result' => '8a0feddbac865a09bcd127fb562ed60a'), - array('offset' => 2032, 'result' => 'b55a0a5b51a12a8be34899c3e047511a'), - array('offset' => 2048, 'result' => 'd9a09cea3ce75fe39698070317a71339'), - array('offset' => 3056, 'result' => '552225ed1177f44584ac8cfa6c4eb5fc'), - array('offset' => 3072, 'result' => '7e82cbabfc95381b080998442129c2f8'), - array('offset' => 4080, 'result' => '1f135ed14ce60a91369d2322bef25e3c'), - array('offset' => 4096, 'result' => '08b6be45124a43e2eb77953f84dc8553') - ) - ), - array( + 'output' => [ + ['offset' => 0, 'result' => 'ede3b04643e586cc907dc21851709902'], + ['offset' => 16, 'result' => '03516ba78f413beb223aa5d4d2df6711'], + ['offset' => 240, 'result' => '3cfd6cb58ee0fdde640176ad0000044d'], + ['offset' => 256, 'result' => '48532b21fb6079c9114c0ffd9c04a1ad'], + ['offset' => 496, 'result' => '3e8cea98017109979084b1ef92f99d86'], + ['offset' => 512, 'result' => 'e20fb49bdb337ee48b8d8dc0f4afeffe'], + ['offset' => 752, 'result' => '5c2521eacd7966f15e056544bea0d315'], + ['offset' => 768, 'result' => 'e067a7031931a246a6c3875d2f678acb'], + ['offset' => 1008, 'result' => 'a64f70af88ae56b6f87581c0e23e6b08'], + ['offset' => 1024, 'result' => 'f449031de312814ec6f319291f4a0516'], + ['offset' => 1520, 'result' => 'bdae85924b3cb1d0a2e33a30c6d79599'], + ['offset' => 1536, 'result' => '8a0feddbac865a09bcd127fb562ed60a'], + ['offset' => 2032, 'result' => 'b55a0a5b51a12a8be34899c3e047511a'], + ['offset' => 2048, 'result' => 'd9a09cea3ce75fe39698070317a71339'], + ['offset' => 3056, 'result' => '552225ed1177f44584ac8cfa6c4eb5fc'], + ['offset' => 3072, 'result' => '7e82cbabfc95381b080998442129c2f8'], + ['offset' => 4080, 'result' => '1f135ed14ce60a91369d2322bef25e3c'], + ['offset' => 4096, 'result' => '08b6be45124a43e2eb77953f84dc8553'] + ] + ], + [ 'key' => pack('H*', '0102030405060708090a0b0c0d0e0f10'), // 128-bit key - 'output' => array( - array('offset' => 0, 'result' => '9ac7cc9a609d1ef7b2932899cde41b97'), - array('offset' => 16, 'result' => '5248c4959014126a6e8a84f11d1a9e1c'), - array('offset' => 240, 'result' => '065902e4b620f6cc36c8589f66432f2b'), - array('offset' => 256, 'result' => 'd39d566bc6bce3010768151549f3873f'), - array('offset' => 496, 'result' => 'b6d1e6c4a5e4771cad79538df295fb11'), - array('offset' => 512, 'result' => 'c68c1d5c559a974123df1dbc52a43b89'), - array('offset' => 752, 'result' => 'c5ecf88de897fd57fed301701b82a259'), - array('offset' => 768, 'result' => 'eccbe13de1fcc91c11a0b26c0bc8fa4d'), - array('offset' => 1008, 'result' => 'e7a72574f8782ae26aabcf9ebcd66065'), - array('offset' => 1024, 'result' => 'bdf0324e6083dcc6d3cedd3ca8c53c16'), - array('offset' => 1520, 'result' => 'b40110c4190b5622a96116b0017ed297'), - array('offset' => 1536, 'result' => 'ffa0b514647ec04f6306b892ae661181'), - array('offset' => 2032, 'result' => 'd03d1bc03cd33d70dff9fa5d71963ebd'), - array('offset' => 2048, 'result' => '8a44126411eaa78bd51e8d87a8879bf5'), - array('offset' => 3056, 'result' => 'fabeb76028ade2d0e48722e46c4615a3'), - array('offset' => 3072, 'result' => 'c05d88abd50357f935a63c59ee537623'), - array('offset' => 4080, 'result' => 'ff38265c1642c1abe8d3c2fe5e572bf8'), - array('offset' => 4096, 'result' => 'a36a4c301ae8ac13610ccbc12256cacc') - ) - ), - array( + 'output' => [ + ['offset' => 0, 'result' => '9ac7cc9a609d1ef7b2932899cde41b97'], + ['offset' => 16, 'result' => '5248c4959014126a6e8a84f11d1a9e1c'], + ['offset' => 240, 'result' => '065902e4b620f6cc36c8589f66432f2b'], + ['offset' => 256, 'result' => 'd39d566bc6bce3010768151549f3873f'], + ['offset' => 496, 'result' => 'b6d1e6c4a5e4771cad79538df295fb11'], + ['offset' => 512, 'result' => 'c68c1d5c559a974123df1dbc52a43b89'], + ['offset' => 752, 'result' => 'c5ecf88de897fd57fed301701b82a259'], + ['offset' => 768, 'result' => 'eccbe13de1fcc91c11a0b26c0bc8fa4d'], + ['offset' => 1008, 'result' => 'e7a72574f8782ae26aabcf9ebcd66065'], + ['offset' => 1024, 'result' => 'bdf0324e6083dcc6d3cedd3ca8c53c16'], + ['offset' => 1520, 'result' => 'b40110c4190b5622a96116b0017ed297'], + ['offset' => 1536, 'result' => 'ffa0b514647ec04f6306b892ae661181'], + ['offset' => 2032, 'result' => 'd03d1bc03cd33d70dff9fa5d71963ebd'], + ['offset' => 2048, 'result' => '8a44126411eaa78bd51e8d87a8879bf5'], + ['offset' => 3056, 'result' => 'fabeb76028ade2d0e48722e46c4615a3'], + ['offset' => 3072, 'result' => 'c05d88abd50357f935a63c59ee537623'], + ['offset' => 4080, 'result' => 'ff38265c1642c1abe8d3c2fe5e572bf8'], + ['offset' => 4096, 'result' => 'a36a4c301ae8ac13610ccbc12256cacc'] + ] + ], + [ 'key' => pack('H*', '0102030405060708090a0b0c0d0e0f101112131415161718'), // 192-bit key - 'output' => array( - array('offset' => 0, 'result' => '0595e57fe5f0bb3c706edac8a4b2db11'), - array('offset' => 16, 'result' => 'dfde31344a1af769c74f070aee9e2326'), - array('offset' => 240, 'result' => 'b06b9b1e195d13d8f4a7995c4553ac05'), - array('offset' => 256, 'result' => '6bd2378ec341c9a42f37ba79f88a32ff'), - array('offset' => 496, 'result' => 'e70bce1df7645adb5d2c4130215c3522'), - array('offset' => 512, 'result' => '9a5730c7fcb4c9af51ffda89c7f1ad22'), - array('offset' => 752, 'result' => '0485055fd4f6f0d963ef5ab9a5476982'), - array('offset' => 768, 'result' => '591fc66bcda10e452b03d4551f6b62ac'), - array('offset' => 1008, 'result' => '2753cc83988afa3e1688a1d3b42c9a02'), - array('offset' => 1024, 'result' => '93610d523d1d3f0062b3c2a3bbc7c7f0'), - array('offset' => 1520, 'result' => '96c248610aadedfeaf8978c03de8205a'), - array('offset' => 1536, 'result' => '0e317b3d1c73b9e9a4688f296d133a19'), - array('offset' => 2032, 'result' => 'bdf0e6c3cca5b5b9d533b69c56ada120'), - array('offset' => 2048, 'result' => '88a218b6e2ece1e6246d44c759d19b10'), - array('offset' => 3056, 'result' => '6866397e95c140534f94263421006e40'), - array('offset' => 3072, 'result' => '32cb0a1e9542c6b3b8b398abc3b0f1d5'), - array('offset' => 4080, 'result' => '29a0b8aed54a132324c62e423f54b4c8'), - array('offset' => 4096, 'result' => '3cb0f3b5020a98b82af9fe154484a168') - ) - ), - array( + 'output' => [ + ['offset' => 0, 'result' => '0595e57fe5f0bb3c706edac8a4b2db11'], + ['offset' => 16, 'result' => 'dfde31344a1af769c74f070aee9e2326'], + ['offset' => 240, 'result' => 'b06b9b1e195d13d8f4a7995c4553ac05'], + ['offset' => 256, 'result' => '6bd2378ec341c9a42f37ba79f88a32ff'], + ['offset' => 496, 'result' => 'e70bce1df7645adb5d2c4130215c3522'], + ['offset' => 512, 'result' => '9a5730c7fcb4c9af51ffda89c7f1ad22'], + ['offset' => 752, 'result' => '0485055fd4f6f0d963ef5ab9a5476982'], + ['offset' => 768, 'result' => '591fc66bcda10e452b03d4551f6b62ac'], + ['offset' => 1008, 'result' => '2753cc83988afa3e1688a1d3b42c9a02'], + ['offset' => 1024, 'result' => '93610d523d1d3f0062b3c2a3bbc7c7f0'], + ['offset' => 1520, 'result' => '96c248610aadedfeaf8978c03de8205a'], + ['offset' => 1536, 'result' => '0e317b3d1c73b9e9a4688f296d133a19'], + ['offset' => 2032, 'result' => 'bdf0e6c3cca5b5b9d533b69c56ada120'], + ['offset' => 2048, 'result' => '88a218b6e2ece1e6246d44c759d19b10'], + ['offset' => 3056, 'result' => '6866397e95c140534f94263421006e40'], + ['offset' => 3072, 'result' => '32cb0a1e9542c6b3b8b398abc3b0f1d5'], + ['offset' => 4080, 'result' => '29a0b8aed54a132324c62e423f54b4c8'], + ['offset' => 4096, 'result' => '3cb0f3b5020a98b82af9fe154484a168'] + ] + ], + [ 'key' => pack('H*', '0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20'), // 256-bit key - 'output' => array( - array('offset' => 0, 'result' => 'eaa6bd25880bf93d3f5d1e4ca2611d91'), - array('offset' => 16, 'result' => 'cfa45c9f7e714b54bdfa80027cb14380'), - array('offset' => 240, 'result' => '114ae344ded71b35f2e60febad727fd8'), - array('offset' => 256, 'result' => '02e1e7056b0f623900496422943e97b6'), - array('offset' => 496, 'result' => '91cb93c787964e10d9527d999c6f936b'), - array('offset' => 512, 'result' => '49b18b42f8e8367cbeb5ef104ba1c7cd'), - array('offset' => 752, 'result' => '87084b3ba700bade955610672745b374'), - array('offset' => 768, 'result' => 'e7a7b9e9ec540d5ff43bdb12792d1b35'), - array('offset' => 1008, 'result' => 'c799b596738f6b018c76c74b1759bd90'), - array('offset' => 1024, 'result' => '7fec5bfd9f9b89ce6548309092d7e958'), - array('offset' => 1520, 'result' => '40f250b26d1f096a4afd4c340a588815'), - array('offset' => 1536, 'result' => '3e34135c79db010200767651cf263073'), - array('offset' => 2032, 'result' => 'f656abccf88dd827027b2ce917d464ec'), - array('offset' => 2048, 'result' => '18b62503bfbc077fbabb98f20d98ab34'), - array('offset' => 3056, 'result' => '8aed95ee5b0dcbfbef4eb21d3a3f52f9'), - array('offset' => 3072, 'result' => '625a1ab00ee39a5327346bddb01a9c18'), - array('offset' => 4080, 'result' => 'a13a7c79c7e119b5ab0296ab28c300b9'), - array('offset' => 4096, 'result' => 'f3e4c0a2e02d1d01f7f0a74618af2b48') - ) - ) - ); + 'output' => [ + ['offset' => 0, 'result' => 'eaa6bd25880bf93d3f5d1e4ca2611d91'], + ['offset' => 16, 'result' => 'cfa45c9f7e714b54bdfa80027cb14380'], + ['offset' => 240, 'result' => '114ae344ded71b35f2e60febad727fd8'], + ['offset' => 256, 'result' => '02e1e7056b0f623900496422943e97b6'], + ['offset' => 496, 'result' => '91cb93c787964e10d9527d999c6f936b'], + ['offset' => 512, 'result' => '49b18b42f8e8367cbeb5ef104ba1c7cd'], + ['offset' => 752, 'result' => '87084b3ba700bade955610672745b374'], + ['offset' => 768, 'result' => 'e7a7b9e9ec540d5ff43bdb12792d1b35'], + ['offset' => 1008, 'result' => 'c799b596738f6b018c76c74b1759bd90'], + ['offset' => 1024, 'result' => '7fec5bfd9f9b89ce6548309092d7e958'], + ['offset' => 1520, 'result' => '40f250b26d1f096a4afd4c340a588815'], + ['offset' => 1536, 'result' => '3e34135c79db010200767651cf263073'], + ['offset' => 2032, 'result' => 'f656abccf88dd827027b2ce917d464ec'], + ['offset' => 2048, 'result' => '18b62503bfbc077fbabb98f20d98ab34'], + ['offset' => 3056, 'result' => '8aed95ee5b0dcbfbef4eb21d3a3f52f9'], + ['offset' => 3072, 'result' => '625a1ab00ee39a5327346bddb01a9c18'], + ['offset' => 4080, 'result' => 'a13a7c79c7e119b5ab0296ab28c300b9'], + ['offset' => 4096, 'result' => 'f3e4c0a2e02d1d01f7f0a74618af2b48'] + ] + ] + ]; - $result = array(); + $result = []; foreach ($engines as $engine) { foreach ($tests as $test) { foreach ($test['output'] as $output) { - $result[] = array($engine, $test['key'], $output['offset'], $output['result']); + $result[] = [$engine, $test['key'], $output['offset'], $output['result']]; } } } @@ -213,7 +213,7 @@ class Unit_Crypt_RC4Test extends PhpseclibTestCase public function testKeySizes() { - $objects = $engines = array(); + $objects = $engines = []; $temp = new RC4(RC4::MODE_CTR); $temp->setPreferredEngine('internal'); $objects[] = $temp; diff --git a/tests/Unit/Crypt/RSA/CreateKeyTest.php b/tests/Unit/Crypt/RSA/CreateKeyTest.php index 0d4c22d1..20107991 100644 --- a/tests/Unit/Crypt/RSA/CreateKeyTest.php +++ b/tests/Unit/Crypt/RSA/CreateKeyTest.php @@ -21,7 +21,7 @@ class Unit_Crypt_RSA_CreateKeyTest extends PhpseclibTestCase $this->assertSame($privatekey->getLength(), 768); $this->assertSame($publickey->getLength(), 768); - return array($publickey, $privatekey); + return [$publickey, $privatekey]; } /** diff --git a/tests/Unit/Crypt/RSA/LoadKeyTest.php b/tests/Unit/Crypt/RSA/LoadKeyTest.php index 6a227919..c4ea67c4 100644 --- a/tests/Unit/Crypt/RSA/LoadKeyTest.php +++ b/tests/Unit/Crypt/RSA/LoadKeyTest.php @@ -61,7 +61,7 @@ X6zk7S0ljKtt2jny2+00VsBerQJBAJGC1Mg5Oydo5NwD6BiROrPxGo2bpTbu/fhrT8ebHkTz2epl U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ 37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0= -----END RSA PRIVATE KEY-----'; - $key = str_replace(array("\r", "\n", "\r\n"), ' ', $key); + $key = str_replace(["\r", "\n", "\r\n"], ' ', $key); $this->assertTrue($rsa->load($key)); $this->assertInternalType('string', $rsa->getPrivateKey()); @@ -400,13 +400,13 @@ Private-MAC: 03e2cb74e1d67652fbad063d2ed0478f31bdf256 { $rsa = new RSA(); - $key = array( + $key = [ 'e' => new BigInteger('10001', 16), 'n' => new BigInteger('aa18aba43b50deef38598faf87d2ab634e4571c130a9bca7b878267414faab8b471bd8965f5c9fc3' . '818485eaf529c26246f3055064a8de19c8c338be5496cbaeb059dc0b358143b44a35449eb2641131' . '21a455bd7fde3fac919e94b56fb9bb4f651cdb23ead439d6cd523eb08191e75b35fd13a7419b3090' . 'f24787bd4f4e1967', 16) - ); + ]; $this->assertTrue($rsa->load($key)); $rsa->setPublicKeyFormat('raw'); $this->assertEmpty("$rsa"); diff --git a/tests/Unit/Crypt/RSA/ModeTest.php b/tests/Unit/Crypt/RSA/ModeTest.php index b9d64dff..df015e51 100644 --- a/tests/Unit/Crypt/RSA/ModeTest.php +++ b/tests/Unit/Crypt/RSA/ModeTest.php @@ -76,7 +76,7 @@ p0GbMJDyR4e9T04ZZwIDAQAB $e = new BigInteger(base64_decode('158753FF2AF4D1E5BBAB574D5AE6B54D'), 256); $rsa = new RSA(); - $rsa->load(array('n' => $n, 'e' => $e)); + $rsa->load(['n' => $n, 'e' => $e]); $rsa->encrypt($plaintext); } diff --git a/tests/Unit/Crypt/RandomTest.php b/tests/Unit/Crypt/RandomTest.php index d531117c..e2cffe5f 100644 --- a/tests/Unit/Crypt/RandomTest.php +++ b/tests/Unit/Crypt/RandomTest.php @@ -11,11 +11,11 @@ class Unit_Crypt_RandomTest extends PhpseclibTestCase { public function stringLengthData() { - return array_map(array($this, 'wrap'), array( + return array_map([$this, 'wrap'], [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, 19, 20, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 111, 128, 1000, 1024, 10000, 12345, 100000, 123456 - )); + ]); } /** @dataProvider stringLengthData */ @@ -34,7 +34,7 @@ class Unit_Crypt_RandomTest extends PhpseclibTestCase */ public function testStringUniqueness() { - $values = array(); + $values = []; for ($i = 0; $i < 10000; ++$i) { $rand = Random::string(16); $this->assertSame(16, strlen($rand)); @@ -50,6 +50,6 @@ class Unit_Crypt_RandomTest extends PhpseclibTestCase protected function wrap($x) { // array() is not a function, but $this->wrap() is. - return array($x); + return [$x]; } } diff --git a/tests/Unit/Crypt/TripleDESTest.php b/tests/Unit/Crypt/TripleDESTest.php index 64350663..6dc5398b 100644 --- a/tests/Unit/Crypt/TripleDESTest.php +++ b/tests/Unit/Crypt/TripleDESTest.php @@ -9,90 +9,90 @@ use phpseclib\Crypt\TripleDES; class Unit_Crypt_TripleDESTest extends PhpseclibTestCase { - var $engines = array( + var $engines = [ 'PHP', 'Eval', 'mcrypt', 'OpenSSL', - ); + ]; public function engineVectors() { // tests from http://csrc.nist.gov/publications/nistpubs/800-20/800-20.pdf#page=273 - $tests = array( + $tests = [ // Table A.1 // key, plaintext, ciphertext - array(str_repeat("\x01", 24), pack('H*', '8000000000000000'), pack('H*', '95F8A5E5DD31D900')), - array(str_repeat("\x01", 24), pack('H*', '4000000000000000'), pack('H*', 'DD7F121CA5015619')), - array(str_repeat("\x01", 24), pack('H*', '2000000000000000'), pack('H*', '2E8653104F3834EA')), - array(str_repeat("\x01", 24), pack('H*', '1000000000000000'), pack('H*', '4BD388FF6CD81D4F')), - array(str_repeat("\x01", 24), pack('H*', '0800000000000000'), pack('H*', '20B9E767B2FB1456')), - array(str_repeat("\x01", 24), pack('H*', '0400000000000000'), pack('H*', '55579380D77138EF')), - array(str_repeat("\x01", 24), pack('H*', '0200000000000000'), pack('H*', '6CC5DEFAAF04512F')), - array(str_repeat("\x01", 24), pack('H*', '0100000000000000'), pack('H*', '0D9F279BA5D87260')), - array(str_repeat("\x01", 24), pack('H*', '0080000000000000'), pack('H*', 'D9031B0271BD5A0A')), - array(str_repeat("\x01", 24), pack('H*', '0040000000000000'), pack('H*', '424250B37C3DD951')), - array(str_repeat("\x01", 24), pack('H*', '0020000000000000'), pack('H*', 'B8061B7ECD9A21E5')), - array(str_repeat("\x01", 24), pack('H*', '0010000000000000'), pack('H*', 'F15D0F286B65BD28')), - array(str_repeat("\x01", 24), pack('H*', '0008000000000000'), pack('H*', 'ADD0CC8D6E5DEBA1')), - array(str_repeat("\x01", 24), pack('H*', '0004000000000000'), pack('H*', 'E6D5F82752AD63D1')), - array(str_repeat("\x01", 24), pack('H*', '0002000000000000'), pack('H*', 'ECBFE3BD3F591A5E')), - array(str_repeat("\x01", 24), pack('H*', '0001000000000000'), pack('H*', 'F356834379D165CD')), - array(str_repeat("\x01", 24), pack('H*', '0000800000000000'), pack('H*', '2B9F982F20037FA9')), - array(str_repeat("\x01", 24), pack('H*', '0000400000000000'), pack('H*', '889DE068A16F0BE6')), - array(str_repeat("\x01", 24), pack('H*', '0000200000000000'), pack('H*', 'E19E275D846A1298')), - array(str_repeat("\x01", 24), pack('H*', '0000100000000000'), pack('H*', '329A8ED523D71AEC')), - array(str_repeat("\x01", 24), pack('H*', '0000080000000000'), pack('H*', 'E7FCE22557D23C97')), - array(str_repeat("\x01", 24), pack('H*', '0000040000000000'), pack('H*', '12A9F5817FF2D65D')), - array(str_repeat("\x01", 24), pack('H*', '0000020000000000'), pack('H*', 'A484C3AD38DC9C19')), - array(str_repeat("\x01", 24), pack('H*', '0000010000000000'), pack('H*', 'FBE00A8A1EF8AD72')), - array(str_repeat("\x01", 24), pack('H*', '0000008000000000'), pack('H*', '750D079407521363')), - array(str_repeat("\x01", 24), pack('H*', '0000004000000000'), pack('H*', '64FEED9C724C2FAF')), - array(str_repeat("\x01", 24), pack('H*', '0000002000000000'), pack('H*', 'F02B263B328E2B60')), - array(str_repeat("\x01", 24), pack('H*', '0000001000000000'), pack('H*', '9D64555A9A10B852')), - array(str_repeat("\x01", 24), pack('H*', '0000000800000000'), pack('H*', 'D106FF0BED5255D7')), - array(str_repeat("\x01", 24), pack('H*', '0000000400000000'), pack('H*', 'E1652C6B138C64A5')), - array(str_repeat("\x01", 24), pack('H*', '0000000200000000'), pack('H*', 'E428581186EC8F46')), - array(str_repeat("\x01", 24), pack('H*', '0000000100000000'), pack('H*', 'AEB5F5EDE22D1A36')), - array(str_repeat("\x01", 24), pack('H*', '0000000080000000'), pack('H*', 'E943D7568AEC0C5C')), - array(str_repeat("\x01", 24), pack('H*', '0000000040000000'), pack('H*', 'DF98C8276F54B04B')), - array(str_repeat("\x01", 24), pack('H*', '0000000020000000'), pack('H*', 'B160E4680F6C696F')), - array(str_repeat("\x01", 24), pack('H*', '0000000010000000'), pack('H*', 'FA0752B07D9C4AB8')), - array(str_repeat("\x01", 24), pack('H*', '0000000008000000'), pack('H*', 'CA3A2B036DBC8502')), - array(str_repeat("\x01", 24), pack('H*', '0000000004000000'), pack('H*', '5E0905517BB59BCF')), - array(str_repeat("\x01", 24), pack('H*', '0000000002000000'), pack('H*', '814EEB3B91D90726')), - array(str_repeat("\x01", 24), pack('H*', '0000000001000000'), pack('H*', '4D49DB1532919C9F')), - array(str_repeat("\x01", 24), pack('H*', '0000000000800000'), pack('H*', '25EB5FC3F8CF0621')), - array(str_repeat("\x01", 24), pack('H*', '0000000000400000'), pack('H*', 'AB6A20C0620D1C6F')), - array(str_repeat("\x01", 24), pack('H*', '0000000000200000'), pack('H*', '79E90DBC98F92CCA')), - array(str_repeat("\x01", 24), pack('H*', '0000000000100000'), pack('H*', '866ECEDD8072BB0E')), - array(str_repeat("\x01", 24), pack('H*', '0000000000080000'), pack('H*', '8B54536F2F3E64A8')), - array(str_repeat("\x01", 24), pack('H*', '0000000000040000'), pack('H*', 'EA51D3975595B86B')), - array(str_repeat("\x01", 24), pack('H*', '0000000000020000'), pack('H*', 'CAFFC6AC4542DE31')), - array(str_repeat("\x01", 24), pack('H*', '0000000000010000'), pack('H*', '8DD45A2DDF90796C')), - array(str_repeat("\x01", 24), pack('H*', '0000000000008000'), pack('H*', '1029D55E880EC2D0')), - array(str_repeat("\x01", 24), pack('H*', '0000000000004000'), pack('H*', '5D86CB23639DBEA9')), - array(str_repeat("\x01", 24), pack('H*', '0000000000002000'), pack('H*', '1D1CA853AE7C0C5F')), - array(str_repeat("\x01", 24), pack('H*', '0000000000001000'), pack('H*', 'CE332329248F3228')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000800'), pack('H*', '8405D1ABE24FB942')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000400'), pack('H*', 'E643D78090CA4207')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000200'), pack('H*', '48221B9937748A23')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000100'), pack('H*', 'DD7C0BBD61FAFD54')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000080'), pack('H*', '2FBC291A570DB5C4')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000040'), pack('H*', 'E07C30D7E4E26E12')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000020'), pack('H*', '0953E2258E8E90A1')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000010'), pack('H*', '5B711BC4CEEBF2EE')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000008'), pack('H*', 'CC083F1E6D9E85F6')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000004'), pack('H*', 'D2FD8867D50D2DFE')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000002'), pack('H*', '06E7EA22CE92708F')), - array(str_repeat("\x01", 24), pack('H*', '0000000000000001'), pack('H*', '166B40B44ABA4BD6')) - ); + [str_repeat("\x01", 24), pack('H*', '8000000000000000'), pack('H*', '95F8A5E5DD31D900')], + [str_repeat("\x01", 24), pack('H*', '4000000000000000'), pack('H*', 'DD7F121CA5015619')], + [str_repeat("\x01", 24), pack('H*', '2000000000000000'), pack('H*', '2E8653104F3834EA')], + [str_repeat("\x01", 24), pack('H*', '1000000000000000'), pack('H*', '4BD388FF6CD81D4F')], + [str_repeat("\x01", 24), pack('H*', '0800000000000000'), pack('H*', '20B9E767B2FB1456')], + [str_repeat("\x01", 24), pack('H*', '0400000000000000'), pack('H*', '55579380D77138EF')], + [str_repeat("\x01", 24), pack('H*', '0200000000000000'), pack('H*', '6CC5DEFAAF04512F')], + [str_repeat("\x01", 24), pack('H*', '0100000000000000'), pack('H*', '0D9F279BA5D87260')], + [str_repeat("\x01", 24), pack('H*', '0080000000000000'), pack('H*', 'D9031B0271BD5A0A')], + [str_repeat("\x01", 24), pack('H*', '0040000000000000'), pack('H*', '424250B37C3DD951')], + [str_repeat("\x01", 24), pack('H*', '0020000000000000'), pack('H*', 'B8061B7ECD9A21E5')], + [str_repeat("\x01", 24), pack('H*', '0010000000000000'), pack('H*', 'F15D0F286B65BD28')], + [str_repeat("\x01", 24), pack('H*', '0008000000000000'), pack('H*', 'ADD0CC8D6E5DEBA1')], + [str_repeat("\x01", 24), pack('H*', '0004000000000000'), pack('H*', 'E6D5F82752AD63D1')], + [str_repeat("\x01", 24), pack('H*', '0002000000000000'), pack('H*', 'ECBFE3BD3F591A5E')], + [str_repeat("\x01", 24), pack('H*', '0001000000000000'), pack('H*', 'F356834379D165CD')], + [str_repeat("\x01", 24), pack('H*', '0000800000000000'), pack('H*', '2B9F982F20037FA9')], + [str_repeat("\x01", 24), pack('H*', '0000400000000000'), pack('H*', '889DE068A16F0BE6')], + [str_repeat("\x01", 24), pack('H*', '0000200000000000'), pack('H*', 'E19E275D846A1298')], + [str_repeat("\x01", 24), pack('H*', '0000100000000000'), pack('H*', '329A8ED523D71AEC')], + [str_repeat("\x01", 24), pack('H*', '0000080000000000'), pack('H*', 'E7FCE22557D23C97')], + [str_repeat("\x01", 24), pack('H*', '0000040000000000'), pack('H*', '12A9F5817FF2D65D')], + [str_repeat("\x01", 24), pack('H*', '0000020000000000'), pack('H*', 'A484C3AD38DC9C19')], + [str_repeat("\x01", 24), pack('H*', '0000010000000000'), pack('H*', 'FBE00A8A1EF8AD72')], + [str_repeat("\x01", 24), pack('H*', '0000008000000000'), pack('H*', '750D079407521363')], + [str_repeat("\x01", 24), pack('H*', '0000004000000000'), pack('H*', '64FEED9C724C2FAF')], + [str_repeat("\x01", 24), pack('H*', '0000002000000000'), pack('H*', 'F02B263B328E2B60')], + [str_repeat("\x01", 24), pack('H*', '0000001000000000'), pack('H*', '9D64555A9A10B852')], + [str_repeat("\x01", 24), pack('H*', '0000000800000000'), pack('H*', 'D106FF0BED5255D7')], + [str_repeat("\x01", 24), pack('H*', '0000000400000000'), pack('H*', 'E1652C6B138C64A5')], + [str_repeat("\x01", 24), pack('H*', '0000000200000000'), pack('H*', 'E428581186EC8F46')], + [str_repeat("\x01", 24), pack('H*', '0000000100000000'), pack('H*', 'AEB5F5EDE22D1A36')], + [str_repeat("\x01", 24), pack('H*', '0000000080000000'), pack('H*', 'E943D7568AEC0C5C')], + [str_repeat("\x01", 24), pack('H*', '0000000040000000'), pack('H*', 'DF98C8276F54B04B')], + [str_repeat("\x01", 24), pack('H*', '0000000020000000'), pack('H*', 'B160E4680F6C696F')], + [str_repeat("\x01", 24), pack('H*', '0000000010000000'), pack('H*', 'FA0752B07D9C4AB8')], + [str_repeat("\x01", 24), pack('H*', '0000000008000000'), pack('H*', 'CA3A2B036DBC8502')], + [str_repeat("\x01", 24), pack('H*', '0000000004000000'), pack('H*', '5E0905517BB59BCF')], + [str_repeat("\x01", 24), pack('H*', '0000000002000000'), pack('H*', '814EEB3B91D90726')], + [str_repeat("\x01", 24), pack('H*', '0000000001000000'), pack('H*', '4D49DB1532919C9F')], + [str_repeat("\x01", 24), pack('H*', '0000000000800000'), pack('H*', '25EB5FC3F8CF0621')], + [str_repeat("\x01", 24), pack('H*', '0000000000400000'), pack('H*', 'AB6A20C0620D1C6F')], + [str_repeat("\x01", 24), pack('H*', '0000000000200000'), pack('H*', '79E90DBC98F92CCA')], + [str_repeat("\x01", 24), pack('H*', '0000000000100000'), pack('H*', '866ECEDD8072BB0E')], + [str_repeat("\x01", 24), pack('H*', '0000000000080000'), pack('H*', '8B54536F2F3E64A8')], + [str_repeat("\x01", 24), pack('H*', '0000000000040000'), pack('H*', 'EA51D3975595B86B')], + [str_repeat("\x01", 24), pack('H*', '0000000000020000'), pack('H*', 'CAFFC6AC4542DE31')], + [str_repeat("\x01", 24), pack('H*', '0000000000010000'), pack('H*', '8DD45A2DDF90796C')], + [str_repeat("\x01", 24), pack('H*', '0000000000008000'), pack('H*', '1029D55E880EC2D0')], + [str_repeat("\x01", 24), pack('H*', '0000000000004000'), pack('H*', '5D86CB23639DBEA9')], + [str_repeat("\x01", 24), pack('H*', '0000000000002000'), pack('H*', '1D1CA853AE7C0C5F')], + [str_repeat("\x01", 24), pack('H*', '0000000000001000'), pack('H*', 'CE332329248F3228')], + [str_repeat("\x01", 24), pack('H*', '0000000000000800'), pack('H*', '8405D1ABE24FB942')], + [str_repeat("\x01", 24), pack('H*', '0000000000000400'), pack('H*', 'E643D78090CA4207')], + [str_repeat("\x01", 24), pack('H*', '0000000000000200'), pack('H*', '48221B9937748A23')], + [str_repeat("\x01", 24), pack('H*', '0000000000000100'), pack('H*', 'DD7C0BBD61FAFD54')], + [str_repeat("\x01", 24), pack('H*', '0000000000000080'), pack('H*', '2FBC291A570DB5C4')], + [str_repeat("\x01", 24), pack('H*', '0000000000000040'), pack('H*', 'E07C30D7E4E26E12')], + [str_repeat("\x01", 24), pack('H*', '0000000000000020'), pack('H*', '0953E2258E8E90A1')], + [str_repeat("\x01", 24), pack('H*', '0000000000000010'), pack('H*', '5B711BC4CEEBF2EE')], + [str_repeat("\x01", 24), pack('H*', '0000000000000008'), pack('H*', 'CC083F1E6D9E85F6')], + [str_repeat("\x01", 24), pack('H*', '0000000000000004'), pack('H*', 'D2FD8867D50D2DFE')], + [str_repeat("\x01", 24), pack('H*', '0000000000000002'), pack('H*', '06E7EA22CE92708F')], + [str_repeat("\x01", 24), pack('H*', '0000000000000001'), pack('H*', '166B40B44ABA4BD6')] + ]; - $result = array(); + $result = []; foreach ($this->engines as $engine) { foreach ($tests as $test) { - $result[] = array($engine, $test[0], $test[1], $test[2]); + $result[] = [$engine, $test[0], $test[1], $test[2]]; } } @@ -119,33 +119,33 @@ class Unit_Crypt_TripleDESTest extends PhpseclibTestCase public function engineIVVectors() { - $engines = array( + $engines = [ 'PHP', 'Eval', 'mcrypt', 'OpenSSL', - ); + ]; // tests from http://csrc.nist.gov/groups/STM/cavp/documents/des/DESMMT.pdf - $tests = array( + $tests = [ // key, iv, plaintext, ciphertext - array( + [ pack('H*', '627f460e08104a10' . '43cd265d5840eaf1' . '313edf97df2a8a8c'), pack('H*', '8e29f75ea77e5475'), pack('H*', '326a494cd33fe756'), - pack('H*', 'b22b8d66de970692')), - array( + pack('H*', 'b22b8d66de970692')], + [ pack('H*', '37ae5ebf46dff2dc' . '0754b94f31cbb385' . '5e7fd36dc870bfae'), pack('H*', '3d1de3cc132e3b65'), pack('H*', '84401f78fe6c10876d8ea23094ea5309'), - pack('H*', '7b1f7c7e3b1c948ebd04a75ffba7d2f5')) - ); + pack('H*', '7b1f7c7e3b1c948ebd04a75ffba7d2f5')] + ]; - $result = array(); + $result = []; foreach ($engines as $engine) { foreach ($tests as $test) { - $result[] = array($engine, $test[0], $test[1], $test[2], $test[3]); + $result[] = [$engine, $test[0], $test[1], $test[2], $test[3]]; } } diff --git a/tests/Unit/Crypt/TwofishTest.php b/tests/Unit/Crypt/TwofishTest.php index b5cc33fc..11650f41 100644 --- a/tests/Unit/Crypt/TwofishTest.php +++ b/tests/Unit/Crypt/TwofishTest.php @@ -11,12 +11,12 @@ class Unit_Crypt_TwofishTest extends PhpseclibTestCase { public function testVectors() { - $engines = array( + $engines = [ 'PHP', 'Eval', 'mcrypt', 'OpenSSL', - ); + ]; foreach ($engines as $engine) { $tf = new Twofish('cbc'); diff --git a/tests/Unit/File/ASN1Test.php b/tests/Unit/File/ASN1Test.php index 949f4bc8..39f7097a 100644 --- a/tests/Unit/File/ASN1Test.php +++ b/tests/Unit/File/ASN1Test.php @@ -15,53 +15,53 @@ class Unit_File_ASN1Test extends PhpseclibTestCase */ public function testAnyString() { - $KDC_REP = array( + $KDC_REP = [ 'type' => ASN1::TYPE_SEQUENCE, - 'children' => array( - 'pvno' => array( + 'children' => [ + 'pvno' => [ 'constant' => 0, 'optional' => true, 'explicit' => true, - 'type' => ASN1::TYPE_ANY), - 'msg-type' => array( + 'type' => ASN1::TYPE_ANY], + 'msg-type' => [ 'constant' => 1, 'optional' => true, 'explicit' => true, - 'type' => ASN1::TYPE_ANY), - 'padata' => array( + 'type' => ASN1::TYPE_ANY], + 'padata' => [ 'constant' => 2, 'optional' => true, 'explicit' => true, - 'type' => ASN1::TYPE_ANY), - 'crealm' => array( + 'type' => ASN1::TYPE_ANY], + 'crealm' => [ 'constant' => 3, 'optional' => true, 'explicit' => true, - 'type' => ASN1::TYPE_ANY), - 'cname' => array( + 'type' => ASN1::TYPE_ANY], + 'cname' => [ 'constant' => 4, 'optional' => true, 'explicit' => true, - 'type' => ASN1::TYPE_ANY), - 'ticket' => array( + 'type' => ASN1::TYPE_ANY], + 'ticket' => [ 'constant' => 5, 'optional' => true, 'explicit' => true, - 'type' => ASN1::TYPE_ANY), - 'enc-part' => array( + 'type' => ASN1::TYPE_ANY], + 'enc-part' => [ 'constant' => 6, 'optional' => true, 'explicit' => true, - 'type' => ASN1::TYPE_ANY) - ) - ); + 'type' => ASN1::TYPE_ANY] + ] + ]; - $AS_REP = array( + $AS_REP = [ 'class' => ASN1::CLASS_APPLICATION, 'cast' => 11, 'optional' => true, 'explicit' => true - ) + $KDC_REP; + ] + $KDC_REP; $str = 'a4IC3jCCAtqgAwIBBaEDAgELoi8wLTAroQMCAROiJAQiMCAwHqADAgEXoRcbFUNSRUFUVUlUWS5ORVR0ZXN0dXNlcqMPGw' . '1DUkVBVFVJVFkuTkVUpBUwE6ADAgEBoQwwChsIdGVzdHVzZXKlggFOYYIBSjCCAUagAwIBBaEPGw1DUkVBVFVJVFkuTkVU' . @@ -87,132 +87,132 @@ class Unit_File_ASN1Test extends PhpseclibTestCase */ public function testIncorrectString() { - $PA_DATA = array( + $PA_DATA = [ 'type' => ASN1::TYPE_SEQUENCE, - 'children' => array( - 'padata-type' => array( + 'children' => [ + 'padata-type' => [ 'constant' => 1, 'optional' => true, 'explicit' => true, 'type' => ASN1::TYPE_INTEGER - ), - 'padata-value' => array( + ], + 'padata-value' => [ 'constant' => 2, 'optional' => true, 'explicit' => true, 'type' => ASN1::TYPE_OCTET_STRING - ) - ) - ); + ] + ] + ]; - $PrincipalName = array( + $PrincipalName = [ 'type' => ASN1::TYPE_SEQUENCE, - 'children' => array( - 'name-type' => array( + 'children' => [ + 'name-type' => [ 'constant' => 0, 'optional' => true, 'explicit' => true, 'type' => ASN1::TYPE_INTEGER - ), - 'name-string' => array( + ], + 'name-string' => [ 'constant' => 1, 'optional' => true, 'explicit' => true, 'min' => 0, 'max' => -1, 'type' => ASN1::TYPE_SEQUENCE, - 'children' => array('type' => ASN1::TYPE_IA5_STRING) // should be \phpseclib\File\ASN1::TYPE_GENERAL_STRING - ) - ) - ); + 'children' => ['type' => ASN1::TYPE_IA5_STRING] // should be \phpseclib\File\ASN1::TYPE_GENERAL_STRING + ] + ] + ]; - $Ticket = array( + $Ticket = [ 'class' => ASN1::CLASS_APPLICATION, 'cast' => 1, 'optional' => true, 'explicit' => true, 'type' => ASN1::TYPE_SEQUENCE, - 'children' => array( - 'tkt-vno' => array( + 'children' => [ + 'tkt-vno' => [ 'constant' => 0, 'optional' => true, 'explicit' => true, 'type' => ASN1::TYPE_INTEGER - ), - 'realm' => array( + ], + 'realm' => [ 'constant' => 1, 'optional' => true, 'explicit' => true, 'type' => ASN1::TYPE_ANY - ), - 'sname' => array( + ], + 'sname' => [ 'constant' => 2, 'optional' => true, 'explicit' => true, 'type' => ASN1::TYPE_ANY - ), - 'enc-part' => array( + ], + 'enc-part' => [ 'constant' => 3, 'optional' => true, 'explicit' => true, 'type' => ASN1::TYPE_ANY - ) - ) - ); + ] + ] + ]; - $KDC_REP = array( + $KDC_REP = [ 'type' => ASN1::TYPE_SEQUENCE, - 'children' => array( - 'pvno' => array( + 'children' => [ + 'pvno' => [ 'constant' => 0, 'optional' => true, 'explicit' => true, - 'type' => ASN1::TYPE_INTEGER), - 'msg-type' => array( + 'type' => ASN1::TYPE_INTEGER], + 'msg-type' => [ 'constant' => 1, 'optional' => true, 'explicit' => true, - 'type' => ASN1::TYPE_INTEGER), - 'padata' => array( + 'type' => ASN1::TYPE_INTEGER], + 'padata' => [ 'constant' => 2, 'optional' => true, 'explicit' => true, 'min' => 0, 'max' => -1, 'type' => ASN1::TYPE_SEQUENCE, - 'children' => $PA_DATA), - 'crealm' => array( + 'children' => $PA_DATA], + 'crealm' => [ 'constant' => 3, 'optional' => true, 'explicit' => true, - 'type' => ASN1::TYPE_OCTET_STRING), - 'cname' => array( + 'type' => ASN1::TYPE_OCTET_STRING], + 'cname' => [ 'constant' => 4, 'optional' => true, - 'explicit' => true) + $PrincipalName, + 'explicit' => true] + $PrincipalName, //'type' => ASN1::TYPE_ANY), - 'ticket' => array( + 'ticket' => [ 'constant' => 5, 'optional' => true, 'implicit' => true, 'min' => 0, 'max' => 1, 'type' => ASN1::TYPE_SEQUENCE, - 'children' => $Ticket), - 'enc-part' => array( + 'children' => $Ticket], + 'enc-part' => [ 'constant' => 6, 'optional' => true, 'explicit' => true, - 'type' => ASN1::TYPE_ANY) - ) - ); + 'type' => ASN1::TYPE_ANY] + ] + ]; - $AS_REP = array( + $AS_REP = [ 'class' => ASN1::CLASS_APPLICATION, 'cast' => 11, 'optional' => true, 'explicit' => true - ) + $KDC_REP; + ] + $KDC_REP; $str = 'a4IC3jCCAtqgAwIBBaEDAgELoi8wLTAroQMCAROiJAQiMCAwHqADAgEXoRcbFUNSRUFUVUlUWS5ORVR0ZXN0dXNlcqMPGw' . '1DUkVBVFVJVFkuTkVUpBUwE6ADAgEBoQwwChsIdGVzdHVzZXKlggFOYYIBSjCCAUagAwIBBaEPGw1DUkVBVFVJVFkuTkVU' . diff --git a/tests/Unit/File/X509/CSRTest.php b/tests/Unit/File/X509/CSRTest.php index 26e3960a..a9dc47a9 100644 --- a/tests/Unit/File/X509/CSRTest.php +++ b/tests/Unit/File/X509/CSRTest.php @@ -115,7 +115,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ 37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0= -----END RSA PRIVATE KEY-----'); $x509->setPrivateKey($rsa); - $x509->setDN(array('cn' => 'website.com')); + $x509->setDN(['cn' => 'website.com']); $x509->saveCSR($x509->signCSR('sha256WithRSAEncryption'), X509::FORMAT_DER); } } diff --git a/tests/Unit/File/X509/X509Test.php b/tests/Unit/File/X509/X509Test.php index 06404e82..ddfcae6e 100644 --- a/tests/Unit/File/X509/X509Test.php +++ b/tests/Unit/File/X509/X509Test.php @@ -299,14 +299,14 @@ f/1y2XuLNhBNHMAyTqpYPX8Yvav1c+Z50OMaSXHAnTa20zv8UtiHbaAhwlifCelU Mj93S -----END CERTIFICATE-----'); $x509->loadX509($x509->saveX509($decoded)); - $expected = array( - array( - array('utf8String' => "Al. Marsza\xC5\x82ka Pi\xC5\x82sudskiego 52/54"), - array('utf8String' => '81-382 Gdynia'), - array('utf8String' => 'Polska'), - array('utf8String' => 'pomorskie') - ) - ); + $expected = [ + [ + ['utf8String' => "Al. Marsza\xC5\x82ka Pi\xC5\x82sudskiego 52/54"], + ['utf8String' => '81-382 Gdynia'], + ['utf8String' => 'Polska'], + ['utf8String' => 'pomorskie'] + ] + ]; $this->assertEquals($x509->getDNProp('id-at-postalAddress'), $expected); $expected = "C=PL, O=Urz\xC4\x85d Miasta Gdyni/serialNumber=PESEL: 61060603118, CN=Jerzy Przeworski/postalAddress=" . '0F\X0C"AL. MARSZA\XC5\X82KA PI\XC5\X82SUDSKIEGO 52/54\X0C\X0D81-382 GDYNIA\X0C\X06POLSKA\X0C\X09POMORSKIE/givenName=Jerzy, SN=Przeworski'; diff --git a/tests/Unit/Net/SSH1Test.php b/tests/Unit/Net/SSH1Test.php index 78526e7b..3e33fbf9 100644 --- a/tests/Unit/Net/SSH1Test.php +++ b/tests/Unit/Net/SSH1Test.php @@ -9,19 +9,19 @@ class Unit_Net_SSH1Test extends PhpseclibTestCase { public function formatLogDataProvider() { - return array( - array( - array('hello world'), - array('<--'), + return [ + [ + ['hello world'], + ['<--'], "<--\r\n00000000 68:65:6c:6c:6f:20:77:6f:72:6c:64 hello world\r\n\r\n" - ), - array( - array('hello', 'world'), - array('<--', '<--'), + ], + [ + ['hello', 'world'], + ['<--', '<--'], "<--\r\n00000000 68:65:6c:6c:6f hello\r\n\r\n" . "<--\r\n00000000 77:6f:72:6c:64 world\r\n\r\n" - ), - ); + ], + ]; } /** @@ -34,7 +34,7 @@ class Unit_Net_SSH1Test extends PhpseclibTestCase ->setMethods(null) ->getMock(); - $result = self::callFunc($ssh, 'format_log', array($message_log, $message_number_log)); + $result = self::callFunc($ssh, 'format_log', [$message_log, $message_number_log]); $this->assertEquals($expected, $result); } diff --git a/tests/Unit/Net/SSH2Test.php b/tests/Unit/Net/SSH2Test.php index b670e496..2b490249 100644 --- a/tests/Unit/Net/SSH2Test.php +++ b/tests/Unit/Net/SSH2Test.php @@ -10,19 +10,19 @@ class Unit_Net_SSH2Test extends PhpseclibTestCase { public function formatLogDataProvider() { - return array( - array( - array('hello world'), - array('<--'), + return [ + [ + ['hello world'], + ['<--'], "<--\r\n00000000 68:65:6c:6c:6f:20:77:6f:72:6c:64 hello world\r\n\r\n" - ), - array( - array('hello', 'world'), - array('<--', '<--'), + ], + [ + ['hello', 'world'], + ['<--', '<--'], "<--\r\n00000000 68:65:6c:6c:6f hello\r\n\r\n" . "<--\r\n00000000 77:6f:72:6c:64 world\r\n\r\n" - ), - ); + ], + ]; } /** @@ -32,7 +32,7 @@ class Unit_Net_SSH2Test extends PhpseclibTestCase { $ssh = $this->createSSHMock(); - $result = self::callFunc($ssh, 'format_log', array($message_log, $message_number_log)); + $result = self::callFunc($ssh, 'format_log', [$message_log, $message_number_log]); $this->assertEquals($expected, $result); } @@ -129,7 +129,7 @@ class Unit_Net_SSH2Test extends PhpseclibTestCase { return $this->getMockBuilder('phpseclib\Net\SSH2') ->disableOriginalConstructor() - ->setMethods(array('__destruct')) + ->setMethods(['__destruct']) ->getMock(); } }