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

ActiveLibrary[Security](/categories/security)

coreymcmahon/phpass
===================

PHP Password Library: Easy, secure password management for PHP

v4.0.1(9y ago)039MITPHPPHP &gt;=5.3.7

Since Feb 24Pushed 9y ago1 watchersCompare

[ Source](https://github.com/coreymcmahon/phpass)[ Packagist](https://packagist.org/packages/coreymcmahon/phpass)[ Docs](https://github.com/coreymcmahon/phpass)[ RSS](/packages/coreymcmahon-phpass/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (8)Used By (0)

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 via [Composer](http://getcomposer.org/)
----------------------------------------------------

[](#installation-via-composer)

- Install Composer to your project root:

    ```
    curl -sS https://getcomposer.org/installer | php
    ```
- Add a `composer.json` file to your project:

    ```
    {
      "require" {
        "rych/phpass": "dev-develop"
      }
    }
    ```
- Run the Composer installer:

    ```
    php composer.phar install
    ```

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:

```
