pentagonal / phpass
PHP密码散列库,原由open wall PhPass开发
1.1.0
2017-01-16 06:08 UTC
Requires
- php: >=5.2
This package is not auto-updated.
Last update: 2024-09-14 18:47:41 UTC
README
脚本基于OpenWall的PhPass,基于0.3版本,进行了一些修改和添加了2个方法和命名空间,以便密码散列可以在Composer和命名空间支持的情况下安装。
- 命名空间
- Composer(自动加载)
- PHP 5
- 单元测试
我们进行了一些修改并添加了2个方法和命名空间,以便密码散列可以在Composer和命名空间支持的情况下安装。
我们不声称拥有该项目,但我们只是添加了一些注释,并使其与PHP的新版本更加兼容,以满足我们项目的需求。
变更及附加
VERSION 1.1.0
- Add 1 static method `isMaybeHash` for checking is hashed string
- Add `VERSION` constant
VERSION 1.0
- Dump version to 1.0.0
- Add Comments
- Adding visibility on methods & property
- Add 2 methods alternative `verify` & `hash`
- Remove /dev/urandom , that maybe thrown of error as random state ( default uses loop )
安装
在composer.json
文件中添加依赖,并运行composer install
{ "require": { "pentagonal/phpass": "1.1" } }
使用方法
<?php /** * Require Autoload From Vendor */ require_once(__DIR__ . "/vendor/autoload.php"); /** * Initiate of PasswordHash * @type Object instance of \Pentagonal\PhPass\PasswordHash */ $passwordHash = new \Pentagonal\PhPass\PasswordHash(); /** * Hash the string of password * @uses \Pentagonal\PhPass\PasswordHash::hashPassword([string] password) | or use hash([string] password) as another method aliases * @type string */ $hashedPassword = $passwordHash->hashPassword('The String Plain Text Password'); /** * Check password match * @uses \Pentagonal\PhPass\PasswordHash::checkPassword([string] password, [string] hashedPassword) | or use check([string] password, [string] hashedPassword) as another method aliases * @type string */ $isPasswordMatch = $passwordHash->checkPassword('The String Plain Text Password', $hashedPassword); /** * Check if string maybe hashed */ $isHashed = Pentagonal\PhPass\PasswordHash::isMaybeHash($hashedPassword);