PHP Classes

File: example2.php

Recommend this page to a friend!
  Classes of Ole Aass   Secure Password Generation and Validation   example2.php   Download  
File: example2.php
Role: Example script
Content type: text/plain
Description: Example using HMAC layer
Class: Secure Password Generation and Validation
Create and validate password hashes
Author: By
Last change:
Date: 11 years ago
Size: 494 bytes
 

Contents

Class file image Download
<?php

/**
 * This example uses an extra layer of security by first hashing the password through a
 * HMAC hash before it is sent to the crypt function.
 *
 * To learn more about this method please read through my blog post:
 * http://oleaass.com/two-step-password-hashing-with-hmac-and-bcrypt/
 */

require_once('Password.php');

$pw = new Password;
$pw->hmacEnabled = true;
$pw->hmacKey = file_get_contents('hmacKey.txt');
$hashed = $pw->hash('verysecret');
var_dump($hashed);