first commit

This commit is contained in:
Claudecio Martins
2026-06-16 10:04:10 -03:00
commit a951944997
4463 changed files with 419677 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace WorkbloomERP\Utils;
use Exception;
class CypherUtil {
public static function hash(string $data): string {
if (!isset($_ENV['SYSTEM_CYPHER_ALGO']) || !isset($_ENV['SYSTEM_CYPHER_PEPPER'])) {
throw new Exception('Missing required environment variables for hashing');
}
return hash_hmac(algo: $_ENV['SYSTEM_CYPHER_ALGO'], data: $data, key: $_ENV['SYSTEM_CYPHER_PEPPER']);
}
public static function verify(string $data, string $hash): bool {
return hash_equals(known_string: self::hash($data), user_string: $hash);
}
}