Type in the password field and press Submit to hash it.
Nothing is saved and your connection is encrypted.
The hashed password cannot be decoded and it is safe to share.
<?php
declare(strict_types=1); // TRUE: Forces datatypes to be declared in functions.
function hash_pwd(string $password) {
$hashedPassword = password_hash($password, PASSWORD_BCRYPT);
return $hashedPassword;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hash</title>
<style>
html,body {
background: rgb(24,24,24);
color: rgb(245,245,245);
font-family: sans-serif;
}
code {
color: #00FF41; // Matrix
}
</style>
</head>
<body>
<div class="container">
<?php
if (isset($_POST['password'])) {
$password = $_POST['password'];
$result = hash_pwd($password);
?>
<h1>
Result
</h1>
<p>
<?=$result;?>
</p>
<?php
} else {
?>
<h1>
Input
</h1>
<p>
Type in the password field and press Submit to hash it.<br>
Nothing is saved and your connection is encrypted.<br>
The hashed password cannot be decoded and it is safe to share.
</p>
<form name="hash" action="hash" method="post">
<input type="password" name="password">
<input type="submit" value="Submit" for="hash">
</form>
<?php
}
?>
</div>
<h1>
Here is how it works
</h1>
<div class="container">
<?php
echo '<pre><code>'.htmlspecialchars(file_get_contents('hash.php')).'</code></pre>';
?>
</div>
</body>
</html>