PHP Classes

File: tools/password.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   CMS Airship   tools/password.php   Download  
File: tools/password.php
Role: Example script
Content type: text/plain
Description: Example script
Class: CMS Airship
Content management system with security features
Author: By
Last change: Boyscouting the tools directory.
Merge pull request #112 from UmeshAawte/master

No need of border if using shadow
Date: 7 years ago
Size: 537 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);

use
Airship\Engine\State;
use
ParagonIE\Halite\Password;

require_once \
dirname(__DIR__).'/src/bootstrap.php';

/**
 * Generate an encrypted password hash from the command line.
 */

$state = State::instance();

$hash = Password::hash($argv[1], $state->keyring['auth.password_key']);
if (
Password::verify($argv[1], $hash, $state->keyring['auth.password_key'])) {
    echo
$hash, "\n";
    exit(
0);
} else {
    echo
'Unexpected ciphertext corruption. Is the password key correct?', "\n";
    exit(
255);
}