PHPackages                             rych/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. rych/phpass

ActiveLibrary[Security](/categories/security)

rych/phpass
===========

PHP Password Library: Easy, secure password management for PHP

v3.0.0beta1(13y ago)248801.7k↑16.9%25[2 issues](https://github.com/rchouinard/phpass/issues)[3 PRs](https://github.com/rchouinard/phpass/pulls)4MITPHPPHP &gt;=5.3.8

Since Feb 24Pushed 9y ago13 watchersCompare

[ Source](https://github.com/rchouinard/phpass)[ Packagist](https://packagist.org/packages/rych/phpass)[ Docs](https://github.com/rchouinard/phpass)[ RSS](/packages/rych-phpass/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (6)Used By (4)

PHP Password Library
====================

[](#php-password-library)

The PHP Password Library is designed to ease the tasks associated with working with passwords in PHP. It is capable of generating strong cryptographic password hashes, verifying supplied password strings against those hashes, and calculating the strength of a password string using various algorithms.

This project was inspired by [Openwall's portable hashing library for PHP](http://openwall.com/phpass/) and [PassLib for Python](http://packages.python.org/passlib/).

Features
--------

[](#features)

- Create and verify secure password hashes with only a few lines of code.
- Supports bcrypt and PBKDF2 out of the box.
- Easily extend to support additional hashing methods.
- Additional password strength component based on well-known algorithms.
- Follows the [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) standard for autoloader compatibility.

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

[](#installation)

### PEAR

[](#pear)

Installing via PEAR is a simple matter of including the [PEAR channel](http://rchouinard.github.com/pear/) and installing the `rych/PHPass` package.

```
pear channel-discover rchouinard.github.com/pear
pear install rych/PHPass-2.1.0-alpha
```

### Composer

[](#composer)

[Composer](http://getcomposer.org/) is an easy way to manage dependencies in your PHP projects. The PHP Password Library can be found in the default [Packagist](http://packagist.org/) repository.

After installing Composer into your project, the PHP Password Library can be installed by adding the following lines to your `composer.json` file and running the Composer command line tool:

```
{
  "require": {
    "rych/phpass": "2.1.0-dev"
  }
}
```

Usage
-----

[](#usage)

### Hashing passwords

[](#hashing-passwords)

The library provides the ability to generate strong cryptographic hashes of user passwords using a variety of methods. Each method may be customized as needed, and may also be combined with HMAC hashing when using the base class.

#### Examples

[](#examples)

Use the default bcrypt adapter:

```
