Added hidoi/hajime hash endpoint for if I need it for some reason.

This commit is contained in:
flash 2024-07-30 22:26:01 +00:00
parent 352ecea9b7
commit 5ae9a68f63
2 changed files with 12 additions and 2 deletions

View file

@ -94,7 +94,7 @@ final class MakaiContext {
$routingCtx->register(new DeveloperRoutes($this->templating, $this->contacts, $this->projects)); $routingCtx->register(new DeveloperRoutes($this->templating, $this->contacts, $this->projects));
$routingCtx->register(new AssetsRoutes($this->siteInfo)); $routingCtx->register(new AssetsRoutes($this->siteInfo));
$routingCtx->register(new SSHKeys\SSHKeysRoutes($this->sshKeys)); $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\Ascii\AsciiRoutes($this->templating));
$routingCtx->register(new Tools\Whois\WhoisRoutes($this->templating, $this->csrfp)); $routingCtx->register(new Tools\Whois\WhoisRoutes($this->templating, $this->csrfp));

View file

@ -4,7 +4,7 @@ namespace Makai\Tools;
use Index\XString; use Index\XString;
use Index\Http\Routing\{HttpGet,RouteHandler}; use Index\Http\Routing\{HttpGet,RouteHandler};
class RandomStringRoutes extends RouteHandler { class ToolsRoutes extends RouteHandler {
#[HttpGet('/tools/random')] #[HttpGet('/tools/random')]
public function getRandomString($response, $request): string { public function getRandomString($response, $request): string {
$response->setTypePlain(); $response->setTypePlain();
@ -22,6 +22,16 @@ class RandomStringRoutes extends RouteHandler {
return $out; 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('/key.php')]
#[HttpGet('/rngstr')] #[HttpGet('/rngstr')]
public function getRedirect($response, $request): void { public function getRedirect($response, $request): void {