c
This commit is contained in:
18
inc/Hura8/System/Security/Hash.php
Normal file
18
inc/Hura8/System/Security/Hash.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\System\Security;
|
||||
|
||||
class Hash
|
||||
{
|
||||
|
||||
protected const CHECK_SUM_KEY = "as21321ASDAS"; // can change this key per project
|
||||
|
||||
public static function createCheckSum($txt) : string {
|
||||
return hash_hmac('sha256', $txt, static::CHECK_SUM_KEY);
|
||||
}
|
||||
|
||||
public static function verifyCheckSum($checksum, $txt) : bool {
|
||||
return ($checksum == static::createCheckSum($txt));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user