Password hash generator

Enter password here

Your <user>_id.ini file

Empty, use the form above

Server source code

This is the php code running this page and filling the <user>_id.ini block.

if (array_key_exists('password', $_POST)) {
    echo htmlspecialchars("password=" . password_hash($_POST['password'], PASSWORD_DEFAULT));
} else {
    echo "Empty, use the form above";
}

Standalone script

Call with php-cli, enter the password twice, outputs the hash. Usage:

php hasher.php > login_id.ini
<?php
if ($argc < 2) {
    system("stty -echo");
    $password = substr(fread(STDIN, 80), 0, -1);
    $password2 = substr(fread(STDIN, 80), 0, -1);
    system("stty echo");
    if ($password != $password2) {
        file_put_contents("php://stderr", "Password mismatch\n");
        die();
    }
} else {
    $password = $argv[1];
}
echo "password=" . password_hash($password, PASSWORD_DEFAULT);