moderndeveloperllc/zf2-scrypt
Composer 安装命令:
composer require moderndeveloperllc/zf2-scrypt
包简介
Zend Framework 2 module to generate scrypt password hashes that are compatible with the wg/scrypt Java implementation
README 文档
README
Abandonware
Much like ZF2, this library is consigned to the history books. Use the much better and faster password_hash() in PHP with the PASSWORD_ARGON2ID algorithm.
This class is an additional library (much like Zend\Crypt\Password\Bcrypt) used to generate scrypt password hashes that are compatible with the wg/scrypt Java implementation. While it uses Zend\Crypt\Key\Derivation\Scrypt, it also adds the parameters to the returned string that are required to compare password hashes. Also included is a function to check the type of hash on your passwords. Useful if you are transitioning gradually from bcrypt to scrypt hashes.
NOTE: This is a simple ZF2 wrapper around moderndeveloperllc/scrypt. It provides a service called 'scrypt_password_hasher' that can be called within a Zend Framework 2 application. If you are using a different framework, you may want to just
use the moderndeveloperllc/scrypt project in your composer.json file.
Installing via Composer
Install composer in a common location or in your project:
curl -s http://getcomposer.org/installer | php
Create the composer.json file as follows:
{
"require": {
"moderndeveloperllc/zf2-scrypt" : "0.*"
}
}
Run the composer installer:
php composer.phar install
Copy vendor/moderndeveloperllc/zf2-scrypt/config/zf2-scrypt.local.php.dist to config/autoload/zf2-scrypt.local.php in
your project. Optionally, change the parameters.
Finally, add the module name to your project's config/application.config.php under the modules
key:
<?php
return array(
/* ... */
'modules' => array(
/* ... */
'ModDev\Zf2Scrypt',
),
/* ... */
);
Usage
Hash a password
<?php
// In a class that is ServiceLocatorAwareInterface
$scrypt = $this->getServiceLocator()->get('scrypt_password_hasher');
$securePass = $scrypt->create('user password');
Check the hashed password against an user input
<?php
// In a class that is ServiceLocatorAwareInterface
$scrypt = $this->getServiceLocator()->get('scrypt_password_hasher');
$securePass = 'the stored scrypt value';
$password = 'the password to check';
if ($scrypt->verify($password, $securePass)) {
echo "The password is correct! \n";
} else {
echo "The password is NOT correct.\n";
}
Return the hash algorithm
<?php
// In a class that is ServiceLocatorAwareInterface
$scrypt = $this->getServiceLocator()->get('scrypt_password_hasher');
$passwordhashType = $scrypt->getHashType($hashedPassword);
Check if the password needs rehashing
<?php
// In a class that is ServiceLocatorAwareInterface
$scrypt = $this->getServiceLocator()->get('scrypt_password_hasher');
echo $scrypt->needsRehash($hashedPassword);
moderndeveloperllc/zf2-scrypt 适用场景与选型建议
moderndeveloperllc/zf2-scrypt 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 65 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 12 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「security」 「zend」 「zf2」 「password」 「hashing」 「scrypt」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 moderndeveloperllc/zf2-scrypt 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 moderndeveloperllc/zf2-scrypt 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 moderndeveloperllc/zf2-scrypt 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
LosLog provides some log utility
EdpModuleLayouts is very simple Laminas module for making module-specific layouts insanely easy.
Provide a way to secure accesses to all routes of an symfony application.
Polyfill for mb_ereg(), mb_eregi(), mb_ereg_match(), and mb_ereg_replace*() functions; primary use case is for mbstring on Windows 7.4+
Zend Framework module to leverage the symfony dependency injection container
RCM User HTML views/pages
统计信息
- 总下载量: 65
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3
- 更新时间: 2014-12-19