PHP code example of pentagonal / phpass

1. Go to this page and download the library: Download pentagonal/phpass library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pentagonal / phpass example snippets




/**
 * Require Autoload From Vendor
 */
ct instance of \Pentagonal\PhPass\PasswordHash
 */
$passwordHash = new \Pentagonal\PhPass\PasswordHash();

/**
 * Hash the string of password
 * @uses \Pentagonal\PhPass\PasswordHash::hashPassword([string] password) | or use hash([string] password) as another method aliases
 * @type string
 */
$hashedPassword = $passwordHash->hashPassword('The String Plain Text Password');

/**
 * Check password match
 * @uses \Pentagonal\PhPass\PasswordHash::checkPassword([string] password, [string] hashedPassword) | or use check([string] password, [string] hashedPassword) as another method aliases
 * @type string
 */
$isPasswordMatch = $passwordHash->checkPassword('The String Plain Text Password', $hashedPassword);

/**
 * Check if string maybe hashed 
 */
$isHashed = Pentagonal\PhPass\PasswordHash::isMaybeHash($hashedPassword);