hautelook/phpass

This package is abandoned and no longer maintained. The author suggests using the bordoni/phpass package instead.

Portable PHP password hashing framework

Maintainers

👁 brensch

Package info

github.com/bordoni/phpass

Homepage

pkg:composer/hautelook/phpass

Statistics

Installs: 2 604 368

Dependents: 27

Suggesters: 2

Stars: 15

Open Issues: 2

0.3.6 2012-08-31 00:00 UTC

Requires

  • php: >=5.3.3

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

Public Domain 12f8f5cc03ebb7efd69554f104afe9aa1aa46e1a

securitypasswordcryptblowfish

This package is auto-updated.

Last update: 2022-05-27 16:19:22 UTC


README

This repository is a fork from the original hautelook/phpass which seems to have been deleted on 2021-09-09.

Openwall Phpass, modernized

This is Openwall's Phpass, based on the 0.3 release, but modernized slightly:

  • Namespaced
  • Composer support (Autoloading)
  • PHP 5 style
  • Unit Tested

The changes are minimal and only stylistic. The source code is in the public domain. We claim no ownership, but needed it for one of our projects, and wanted to make it available to other people as well.

Installation

Add this requirement to your composer.json file and run composer.phar install:

{
 "require": {
 "bordoni/phpass": "dev-main"
 }
}

Usage

The following example shows how to hash a password (to then store the hash in the database), and how to check whether a provided password is correct (hashes to the same value):

<?php

namespace Your\Namespace;

use Hautelook\Phpass\PasswordHash;

require_once(__DIR__ . "/vendor/autoload.php");
 
$passwordHasher = new PasswordHash(8,false);
 
$password = $passwordHasher->HashPassword('secret');
var_dump($password);
 
$passwordMatch = $passwordHasher->CheckPassword('secret', "$2a$08$0RK6Yw6j9kSIXrrEOc3dwuDPQuT78HgR0S3/ghOFDEpOGpOkARoSu");
var_dump($passwordMatch);