web-utils/modules/hash/hash.php

20 lines
320 B
PHP
Raw Permalink Normal View History

2021-08-18 21:54:35 +00:00
<?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']);