diff --git a/src/MakaiContext.php b/src/MakaiContext.php index 2e9bb94..52e38c8 100644 --- a/src/MakaiContext.php +++ b/src/MakaiContext.php @@ -94,7 +94,7 @@ final class MakaiContext { $routingCtx->register(new DeveloperRoutes($this->templating, $this->contacts, $this->projects)); $routingCtx->register(new AssetsRoutes($this->siteInfo)); $routingCtx->register(new SSHKeys\SSHKeysRoutes($this->sshKeys)); - $routingCtx->register(new Tools\RandomStringRoutes); + $routingCtx->register(new Tools\ToolsRoutes); $routingCtx->register(new Tools\Ascii\AsciiRoutes($this->templating)); $routingCtx->register(new Tools\Whois\WhoisRoutes($this->templating, $this->csrfp)); diff --git a/src/Tools/RandomStringRoutes.php b/src/Tools/ToolsRoutes.php similarity index 73% rename from src/Tools/RandomStringRoutes.php rename to src/Tools/ToolsRoutes.php index 3ff7901..dccd58a 100644 --- a/src/Tools/RandomStringRoutes.php +++ b/src/Tools/ToolsRoutes.php @@ -4,7 +4,7 @@ namespace Makai\Tools; use Index\XString; use Index\Http\Routing\{HttpGet,RouteHandler}; -class RandomStringRoutes extends RouteHandler { +class ToolsRoutes extends RouteHandler { #[HttpGet('/tools/random')] public function getRandomString($response, $request): string { $response->setTypePlain(); @@ -22,6 +22,16 @@ class RandomStringRoutes extends RouteHandler { return $out; } + #[HttpGet('/tools/hajime-hash')] + #[HttpGet('/tools/hidoi-hash')] + public function getHajimeHash($response, $request): string { + $response->setTypePlain(); + if(!$request->hasParam('text')) + return 'text param is empty'; + + return hash('sha256', strrev(hash('sha256', (string)$request->getParam('text')))); + } + #[HttpGet('/key.php')] #[HttpGet('/rngstr')] public function getRedirect($response, $request): void {