davidkuridza / php-bcrypt-wrapper
简单的PHP bcrypt包装器
dev-master
2013-10-07 05:17 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: ~3.7.10
This package is not auto-updated.
Last update: 2024-09-28 13:09:22 UTC
README
请使用PHP的密码散列函数或password_compat。
PHP bcrypt包装器
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
将调用clean
和tests
。
使用方法
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.si或twitter联系我。