mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-14 01:57:20 +01:00
Merge branch '2.0'
This commit is contained in:
commit
1b0d423245
@ -26,7 +26,7 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
|
|||||||
$expected = pack('H*', $expected);
|
$expected = pack('H*', $expected);
|
||||||
|
|
||||||
$engines = ['PHP', 'OpenSSL', 'libsodium'];
|
$engines = ['PHP', 'OpenSSL', 'libsodium'];
|
||||||
for ($engines as $engine) {
|
foreach ($engines as $engine) {
|
||||||
$c = new ChaCha20();
|
$c = new ChaCha20();
|
||||||
$c->setKey($key);
|
$c->setKey($key);
|
||||||
$c->setNonce($nonce);
|
$c->setNonce($nonce);
|
||||||
@ -63,8 +63,8 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
|
|||||||
$expected = str_replace(' ', '', $expected);
|
$expected = str_replace(' ', '', $expected);
|
||||||
$expected = pack('H*', $expected);
|
$expected = pack('H*', $expected);
|
||||||
|
|
||||||
$engines = ['PHP', OpenSSL', 'libsodium'];
|
$engines = ['PHP', 'OpenSSL', 'libsodium'];
|
||||||
for ($engines as $engine) {
|
foreach ($engines as $engine) {
|
||||||
$c = new ChaCha20();
|
$c = new ChaCha20();
|
||||||
$c->setKey($key);
|
$c->setKey($key);
|
||||||
$c->setNonce($nonce);
|
$c->setNonce($nonce);
|
||||||
@ -119,8 +119,8 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
|
|||||||
$expected = str_replace(' ', '', $expected);
|
$expected = str_replace(' ', '', $expected);
|
||||||
$expected = pack('H*', $expected);
|
$expected = pack('H*', $expected);
|
||||||
|
|
||||||
$engines = ['PHP', OpenSSL', 'libsodium'];
|
$engines = ['PHP', 'OpenSSL', 'libsodium'];
|
||||||
for ($engines as $engine) {
|
foreach ($engines as $engine) {
|
||||||
$c = new ChaCha20();
|
$c = new ChaCha20();
|
||||||
$c->setKey($key);
|
$c->setKey($key);
|
||||||
$c->setNonce($nonce);
|
$c->setNonce($nonce);
|
||||||
@ -163,8 +163,8 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
|
|||||||
$tag = str_replace(' ', '', $tag);
|
$tag = str_replace(' ', '', $tag);
|
||||||
$tag = pack('H*', $tag);
|
$tag = pack('H*', $tag);
|
||||||
|
|
||||||
$engines = ['PHP', OpenSSL', 'libsodium'];
|
$engines = ['PHP', 'OpenSSL', 'libsodium'];
|
||||||
for ($engines as $engine) {
|
foreach ($engines as $engine) {
|
||||||
$c = new ChaCha20();
|
$c = new ChaCha20();
|
||||||
$c->enablePoly1305();
|
$c->enablePoly1305();
|
||||||
$c->setKey($key);
|
$c->setKey($key);
|
||||||
@ -189,8 +189,8 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
|
|||||||
|
|
||||||
$plaintext = str_repeat("\0", array_sum($partitions));
|
$plaintext = str_repeat("\0", array_sum($partitions));
|
||||||
|
|
||||||
$engines = ['PHP', OpenSSL', 'libsodium'];
|
$engines = ['PHP', 'OpenSSL', 'libsodium'];
|
||||||
for ($engines as $engine) {
|
foreach ($engines as $engine) {
|
||||||
$c = new ChaCha20();
|
$c = new ChaCha20();
|
||||||
$c->setKey($key);
|
$c->setKey($key);
|
||||||
$c->setNonce($nonce);
|
$c->setNonce($nonce);
|
||||||
|
@ -154,7 +154,7 @@ class Unit_Crypt_Salsa20Test extends PhpseclibTestCase
|
|||||||
if ($cipher->getEngine() != $engine) {
|
if ($cipher->getEngine() != $engine) {
|
||||||
self::markTestSkipped('Unable to initialize ' . $engine . ' engine for ' . (strlen($key) * 8) . '-bit key');
|
self::markTestSkipped('Unable to initialize ' . $engine . ' engine for ' . (strlen($key) * 8) . '-bit key');
|
||||||
}
|
}
|
||||||
$result = $cipher->encrypt(str_repeat("\0", 64);
|
$result = $cipher->encrypt(str_repeat("\0", 64));
|
||||||
$this->assertEquals(bin2hex($result), $expected, "Failed asserting that key $key / $iv yielded expected output in $engine engine");
|
$this->assertEquals(bin2hex($result), $expected, "Failed asserting that key $key / $iv yielded expected output in $engine engine");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user