. */ namespace SP\Tests\Core\Crypt; use Faker\Factory; use PHPUnit\Framework\Attributes\Group; use SP\Core\Crypt\Hash; use SP\Tests\UnitaryTestCase; /** * Class HashTest * */ #[Group('unitary')] class HashTest extends UnitaryTestCase { public function testHashKey() { for ($i = 2; $i <= 128; $i *= 2) { $key = self::$faker->password(2, $i); $hash = Hash::hashKey($key); $this->assertNotEmpty($hash); $this->assertTrue(Hash::checkHashKey($key, $hash)); } } public function testSignMessage() { $faker = Factory::create(); for ($i = 2; $i <= 128; $i *= 2) { $text = $faker->text; $key = self::$faker->password(2, $i); $hash = Hash::signMessage($text, $key); $this->assertNotEmpty($hash); $this->assertTrue(Hash::checkMessage($text, $key, $hash)); } } }