vanilla/garden-password
Composer 安装命令:
composer require vanilla/garden-password
包简介
Provides a standard password hashing interface and support for password hashing in common frameworks.
README 文档
README
Garden Password implements a common interface for various password hashing algorithms.
Why we made Garden Password
Although the industry seems to be settling on bcrypt as a standard for secure password hashes there are still a lot of legacy systems out there. When you want to import data from one of these legacy systems you will need some way to bridge the password hashes so that users can sign in without resetting their passwords.
Installation
Garden Password requires PHP 5.4 or higher. If you want to use the PhpPassword object prior to PHP 5.5 you can require the password-compat package.
Garden Password is PSR-4 compliant and can be installed using composer. Just add vanilla/garden-password to your composer.json.
{
"require": {
"vanilla/garden-password": "~1.0"
}
}
The PasswordInterface
The PasswordInterface is the basic interface that all of the password algorithms adhere to. You should type hint to this interface and then choose an appropriate implementation for your application. We recommend using PhpPassword for new applications. The PasswordInterface is a very simple interface with only three methods.
hash()
public string hash(string $password)
Hash a plaintext password. This will return a one-way, salted hash that is appropriate to store in the database. Once you have this hash you should throw the plaintext password away.
needsRehash()
public string needsRehash(string $hash)
Check to see if an existing password hash needs to be re-hashed. A password needs to be re-hashed when the algorithm had a security concern that was later fixed. You usually call this method when a user signs in and you have their plaintext password. First check to see if their password verifies against the existing hash and then check to see if it needs to be updated. If you need to re-hash then hash the plaintext password again and store the new hash in the database. In this way you can gradually improve the security of your system.
verify()
public bool verify(string $password, string $hash)
Verify a password against a stored hash. This is the method you call to check a user's password when they sign in.
Contributing
If you want to help build out this library we'd really appreciate it. Here are some great ways you can help:
-
Send pull requests with new hashing algorithms. If you know another system and know how its passwords work then send us an implementation.
-
If you know a password hashing algorithm that you want added, but don't want to make a pull-request that's okay. Create an issue and give us the details of the algorithm and we'll implement the algorithm if we can.
-
Send some example password/hash pairs for existing algorithms. If you are running a system with legacy passwords then you can send us some example passwords with their associated hashes. We can then add these to our unit tests. Don't send us passwords you actually use! Just make a temporary password and send it along with its hash.
Note: We cannot reverse engineer a password hashing algorithm from example passwords and hashes.
vanilla/garden-password 适用场景与选型建议
vanilla/garden-password 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 162.41k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 04 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「password」 「garden」 「vanilla」 「vanilla forums」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vanilla/garden-password 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vanilla/garden-password 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vanilla/garden-password 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The PHP class PasswordGenerator serves as a password generator to create memorable passwords like the keychain of macOS ≤ 10.14 did.
Laravel middleware to restrict a site or specific routes using HTTP basic authentication
High-level cryptographic primitives and security utilities for Maatify systems including password hashing, reversible encryption, HKDF key derivation, and key rotation.
A library for reading KeePass 2.x databases
Add a secure password generator to Signup Modal
Make a calculation so users can have a visual response to password input
统计信息
- 总下载量: 162.41k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-17