PHPackages                             ekinhbayar/hautelook-phpass - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. ekinhbayar/hautelook-phpass

ActiveLibrary[Security](/categories/security)

ekinhbayar/hautelook-phpass
===========================

Portable PHP password hashing framework

1.1.0(13y ago)134.1k↑18%1Public DomainPHPPHP &gt;=5.6.0

Since Aug 31Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ekinhbayar/hautelook-phpass)[ Packagist](https://packagist.org/packages/ekinhbayar/hautelook-phpass)[ Docs](http://github.com/hautelook/phpass/)[ RSS](/packages/ekinhbayar-hautelook-phpass/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

hautelook/phpass fork
=====================

[](#hautelookphpass-fork)

This repository exists only because hautelook/phpass repository was deleted. I'm planning to add tests and probably will attempt at a PHP ^8 version of this at some point in the future, however, I can't promise at all that I'll keep maintaining this library.

Openwall Phpass, modernized
===========================

[](#openwall-phpass-modernized)

[![Build Status](https://camo.githubusercontent.com/7660b7140f31eaf64bc95cb38cf69d1660e84c2cf4883c9300dfdaafdb2e6012/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f68617574656c6f6f6b2f7068706173732e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/hautelook/phpass)[![HHVM Status](https://camo.githubusercontent.com/8052c8aa679643c754f8cf42f5831db07bbc8b07e63735663a878b671e7ea91f/687474703a2f2f6868766d2e683463632e64652f62616467652f68617574656c6f6f6b2f7068706173732e706e67)](http://hhvm.h4cc.de/package/hautelook/phpass)

This is Openwall's [Phpass](http://openwall.com/phpass/), based on the 0.3 release, but modernized slightly:

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

The changes are minimal and mostly 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.

- `1.1.0` - Modified to add `random_bytes` hook function.
- `1.0.0` - Modified to use [hash\_equals](http://php.net/hash_equals) to be resistant to timing attacks. This requires `php >= 5.6.0`.
- `0.3.x` - Very close to the original version. Requires `php >= 5.3.3`.

Customizing the Source of Randomness
------------------------------------

[](#customizing-the-source-of-randomness)

In version `1.1.0`, the `get_random_bytes` function checks for the presence of a `random_bytes` function. If a `random_bytes` function is callable, then `random_bytes` will be used as the source for random bytes output. Otherwise, the original `get_random_bytes` code will be used.

Installation
------------

[](#installation)

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

```
{
    "require": {
        "ekinhbayar/hautelook-phpass": "1.1.0"
    }
}

```

Usage
-----

[](#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):

```
