-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add static helper function for hashing
- Loading branch information
Showing
4 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/core/etl/tests/Flow/ETL/Tests/Unit/Hash/NativePHPHashTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Flow\ETL\Tests\Unit\Hash; | ||
|
||
use Flow\ETL\Hash\NativePHPHash; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class NativePHPHashTest extends TestCase | ||
{ | ||
public static function test_hashing_xxh128_by_static_call() : void | ||
{ | ||
static::assertSame( | ||
'6c78e0e3bd51d358d01e758642b85fb8', | ||
NativePHPHash::xxh128('test'), | ||
); | ||
} | ||
|
||
public function test_hashing_string_using_xxh128_by_default() : void | ||
{ | ||
static::assertSame( | ||
'6c78e0e3bd51d358d01e758642b85fb8', | ||
NativePHPHash::xxh128('test'), | ||
); | ||
} | ||
|
||
public function test_support_sha512_hash() : void | ||
{ | ||
static::assertSame( | ||
'ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff', | ||
(new NativePHPHash('sha512'))->hash('test') | ||
); | ||
|
||
} | ||
} |