elnur/blowfish-password-encoder-bundle
Composer 安装命令:
composer require elnur/blowfish-password-encoder-bundle
包简介
Blowfish (bcrypt) based password encoder for Symfony2
README 文档
README
Still using MD5 or SHA family hashing algorithms for password “encryption”?
If you are, read this and
that and then come back to
get yourself a copy of this bundle.
The BCrypt password encoder has been added to the Symfony core in 2.2 and has been improved to the level of this bundle and beyond in 2.3. So, if you're using Symfony 2.3+, consider using the encoder from the core instead of this bundle.
Installation
-
Add this to the
composer.json:{ "require": { "elnur/blowfish-password-encoder-bundle": "~0.5" } }And run:
php composer.phar update elnur/blowfish-password-encoder-bundle -
Enable the bundle in
app/AppKernel.php:public function registerBundles() { $bundles = array( // ... new Elnur\BlowfishPasswordEncoderBundle\ElnurBlowfishPasswordEncoderBundle(), ); } -
And, finally, set the encoder in
app/config/security.yml:security: encoders: Symfony\Component\Security\Core\User\User: id: security.encoder.blowfish
Configuration
By default the encoder uses a cost factor of 15, which is pretty reasonable,
but you can change it to a different value in the range of 4-31 by editing
the config.yml file:
elnur_blowfish_password_encoder:
cost: 10
Each increment of the cost doubles the time it takes to encode a password.
You can change the cost factor at any time — even if you already have some passwords encoded using a different cost factor. New passwords will be encoded using the new cost factor, while the already encoded ones will be validated using a cost factor that was used back when they were encoded.
Usage
A salt for each new password is generated automatically and need not be persisted. Since an encoded password contains the salt used to encode it, persisting the encoded password alone is enough.
All the encoded passwords are 60 characters long, so make sure to allocate
enough space for them to be persisted.
License
This bundle is under the MIT license. See the complete license in the bundle:
Resources/meta/LICENSE
Acknowledgements
I thank asm89 for enlightening me by giving the
links you see above and answering my other related questions on the #symfony
channel.
And I thank dustin10 for suggesting to add the extension class to make the bundle easier to install and configure.
elnur/blowfish-password-encoder-bundle 适用场景与选型建议
elnur/blowfish-password-encoder-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 129.65k 次下载、GitHub Stars 达 61, 最近一次更新时间为 2012 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「security」 「blowfish」 「bcrypt」 「password-encoder」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 elnur/blowfish-password-encoder-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 elnur/blowfish-password-encoder-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 elnur/blowfish-password-encoder-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple class for passwords hashing and checking using Blowfish algorithm
Framework-agnostic password processing library
Provide a way to secure accesses to all routes of an symfony application.
This symfony user provider reads user from the htpasswd file.
Blowfish encryption library
Portable PHP password hashing framework
统计信息
- 总下载量: 129.65k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 62
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-04-15