feat(Hash): add hash module
This commit is contained in:
parent
df5630a701
commit
9eb428c528
2 changed files with 21 additions and 1 deletions
|
@ -19,7 +19,8 @@ return [
|
|||
],
|
||||
'logator' => [
|
||||
'alias' => ['logme']
|
||||
]
|
||||
],
|
||||
'hash' => []
|
||||
],
|
||||
'auth' => [
|
||||
'root' => 'password'
|
||||
|
|
19
modules/hash/hash.php
Normal file
19
modules/hash/hash.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
$supported = hash_algos();
|
||||
|
||||
header("Content-Type: text/plain");
|
||||
|
||||
$algo = $_GET['algo'] ?? 'sha256';
|
||||
|
||||
if (!in_array($algo, $supported)) {
|
||||
echo "Invalid hash algorithm";
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!isset($_GET['data'])) {
|
||||
echo "Data query param is required";
|
||||
exit();
|
||||
}
|
||||
|
||||
echo $algo . ': ' . hash($algo, $_GET['data']);
|
Loading…
Reference in a new issue