19 lines
411 B
PHP
19 lines
411 B
PHP
<?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));
|
|
}
|
|
|
|
}
|