mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-26 19:40:28 +00:00
Merge pull request #450 from terrafrost/hash-96-3
Hash: refactor unit tests * terrafrost/hash-96-3: Hash: rm first parameter of testHMAC call Hash: fix unit tests Hash: refactor unit tests
This commit is contained in:
commit
42edd4d8e4
@ -12,21 +12,19 @@ class Unit_Crypt_Hash_SHA256_96Test extends Unit_Crypt_Hash_SHA256Test
|
|||||||
return new Crypt_Hash('sha256-96');
|
return new Crypt_Hash('sha256-96');
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function hashData()
|
/**
|
||||||
|
* @dataProvider hashData()
|
||||||
|
*/
|
||||||
|
public function testHash($message, $longResult)
|
||||||
{
|
{
|
||||||
$tests = parent::hashData();
|
parent::testHash($message, substr($longResult, 0, 24));
|
||||||
foreach ($tests as &$test) {
|
|
||||||
$test[1] = substr($test[1], 0, 24);
|
|
||||||
}
|
|
||||||
return $tests;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function hmacData()
|
/**
|
||||||
|
* @dataProvider hmacData()
|
||||||
|
*/
|
||||||
|
public function testHMAC($key, $message, $longResult)
|
||||||
{
|
{
|
||||||
$tests = parent::hmacData();
|
parent::testHMAC($key, $message, substr($longResult, 0, 24));
|
||||||
foreach ($tests as &$test) {
|
|
||||||
$test[2] = substr($test[2], 0, 24);
|
|
||||||
}
|
|
||||||
return $tests;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,21 +12,19 @@ class Unit_Crypt_Hash_SHA512_96Test extends Unit_Crypt_Hash_SHA512Test
|
|||||||
return new Crypt_Hash('sha512-96');
|
return new Crypt_Hash('sha512-96');
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function hashData()
|
/**
|
||||||
|
* @dataProvider hashData()
|
||||||
|
*/
|
||||||
|
public function testHash($message, $longResult)
|
||||||
{
|
{
|
||||||
$tests = parent::hashData();
|
parent::testHash($message, substr($longResult, 0, 24));
|
||||||
foreach ($tests as &$test) {
|
|
||||||
$test[1] = substr($test[1], 0, 24);
|
|
||||||
}
|
|
||||||
return $tests;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function hmacData()
|
/**
|
||||||
|
* @dataProvider hmacData()
|
||||||
|
*/
|
||||||
|
public function testHMAC($key, $message, $longResult)
|
||||||
{
|
{
|
||||||
$tests = parent::hmacData();
|
parent::testHMAC($key, $message, substr($longResult, 0, 24));
|
||||||
foreach ($tests as &$test) {
|
|
||||||
$test[2] = substr($test[2], 0, 24);
|
|
||||||
}
|
|
||||||
return $tests;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user