Skip to content

davidkuridza/php-bcrypt-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

PHP bcrypt wrapper

Build Status

PHP bcrypt is a wrapper to simplify the use of bcrypt algorithm in PHP.

Requirements

Installation

Copy Bcrypt/Bcrypt.php to location on the file system where needed.

To test whether Bcrypt works in your environment, you can simply run PHPUnit tests from root directory:

$ phpunit

An Ant build script is provided to simplify setting up the environment in case you would like to contribute. Following targets are available:

$ ant
Buildfile: build.xml

help:
     [echo] Usage: ant [target [target1 [target2] ...]]
     [echo] Targets:
     [echo]   help            print this message
     [echo]   build           setup env
     [echo]   clean           clean up and create artifact directories
     [echo]   tests           run unit tests

Running $ ant build will invoke clean and tests.

Usage

include 'Bcrypt.php';

// hash password before storing it
$hashed = Bcrypt::hash($password);

// check password by comparing it to its hashed value
$check  = Bcrypt::check($password, $hashed);

// use a stronger salt
$salt   = Bcrypt::salt(24); // 2^24 iterations
$hashed = Bcrypt::hash($password, $salt);

Contact

Feel free to contact me via david@kuridza.si or twitter.

About

Simple PHP bcrypt wrapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages