davidkuridza/php-bcrypt-wrapper

简单的PHP bcrypt包装器

dev-master 2013-10-07 05:17 UTC

This package is not auto-updated.

Last update: 2024-09-28 13:09:22 UTC


README

请使用PHP的密码散列函数password_compat

PHP bcrypt包装器

Build Status

PHP bcrypt是一个用于简化PHP中bcrypt算法使用的包装器。

要求

安装

Bcrypt/Bcrypt.php复制到文件系统中所需的位置。

要测试Bcrypt是否在您的环境中工作,您可以简单地从根目录运行PHPUnit测试

$ phpunit

提供了一份Ant构建脚本,以简化在您想贡献的情况下设置环境。以下目标可用

$ 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

运行$ ant build将调用cleantests

使用方法

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);

联系方式

请随时通过david@kuridza.sitwitter联系我。