1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-10-31 21:33:00 +00:00
Pepperminty-Wiki/modules/action-hash.php

36 lines
1.4 KiB
PHP
Raw Normal View History

2015-09-19 09:19:56 +00:00
<?php
register_module([
"name" => "Password hashing action",
"version" => "0.5",
"author" => "Starbeamrainbowlabs",
"description" => "Adds a utility action (that anyone can use) called hash that hashes a given string. Useful when changing a user's password.",
"id" => "action-hash",
"code" => function() {
/*
* ██ ██ █████ ███████ ██ ██
* ██ ██ ██ ██ ██ ██ ██
* ███████ ███████ ███████ ███████
* ██ ██ ██ ██ ██ ██ ██
* ██ ██ ██ ██ ███████ ██ ██
*/
2015-09-19 09:19:56 +00:00
add_action("hash", function() {
global $settings;
2015-09-19 09:19:56 +00:00
if(!isset($_GET["string"]))
{
http_response_code(422);
exit(page_renderer::render_main("Missing parameter", "<p>The <code>GET</code> parameter <code>string</code> must be specified.</p>
<p>It is strongly recommended that you utilise this page via a private or incognito window in order to prevent your password from appearing in your browser history.</p>"));
}
else
{
exit(page_renderer::render_main("Hashed string", "<p>Algorithm: " . ($settings->use_sha3 ? "sha3" : "sha256") . "</p>\n<p><code>" . $_GET["string"] . "</code> → <code>" . hash_password($_GET["string"]) . "</code></p>"));
2015-09-19 09:19:56 +00:00
}
});
}
]);
?>