feat(Hash): add hash module

This commit is contained in:
Matthieu Bessat 2021-08-18 23:54:35 +02:00
parent df5630a701
commit 9eb428c528
2 changed files with 21 additions and 1 deletions

View file

@ -19,7 +19,8 @@ return [
], ],
'logator' => [ 'logator' => [
'alias' => ['logme'] 'alias' => ['logme']
] ],
'hash' => []
], ],
'auth' => [ 'auth' => [
'root' => 'password' 'root' => 'password'

19
modules/hash/hash.php Normal file
View 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']);