postfixadmin/password-hashing
Composer 安装命令:
composer require postfixadmin/password-hashing
包简介
Routines to generate password hashes, useful for Dovecot or Courier Mail servers
README 文档
README
Standalone PHP library for creating various password hashes
Note, this library is still quite new (2021/07/02). It's quite likely to have major refactoring / renaming as it's reviewed.
Supported Mechanisms (hash formats)
See:
Line 12 in 46ddd21
| public const SUPPORTED = [ |
Some mechanisms support either HEX (.HEX) encoded or BASE64 (.B64) encoded output.
Currently:
- SHA1, SHA1.HEX, SHA1.B64
- SSHA
- SSHA512
- BLF-CRYPT, BLF-CRYPT.B64
- SHA512-CRYPT, SHA512-CRYPT.B64
- ARGON2I, ARGON2I.B64
- ARGON2ID, ARGON2ID.B64
- SHA256, SHA256-CRYPT, SHA256-CRYPT.B64
- SHA512, SHA512.B64
- MD5-CRYPT, MD5
- PLAIN-MD5
- CRYPT ({CRYPT} prefix, defaults to use Blowfish)
- SYSTEM (DES CRYPT, best avoid)
- PLAIN, CLEAR, CLEARTEXT (useful for testing)
- COURIER:MD5
- COURIER:MD5RAW
- COURIER:SSHA (same as SSHA)
- COURIER:SHA256 (same as SHA256)
Example usage
The main functionality reflects legacy behaviour in PostfixAdmin with a 'pacrypt' function, which when given ...
- one argument - clear text password - returns a hash.
- two arguments - clear text password and stored hash - if the return value matches the stored hash, then the clear text password was a match for the hash we have.
$tool = new \PostfixAdmin\PasswordHashing\Crypt('ARGON2I'); // should output something to indicate what your system supports (may be dependent on PHP variant, PHP modules etc) $hash = $tool->crypt('fishbeans'); echo "Hash is: $hash \n"; echo "Verify: " . json_encode($hash == $tool->crypt('fishbeans', $hash)) . "\n"; echo "Verify fails with: " . json_encode('cat' == $tool->crypt('fishbeans', $hash)) . "\n";
the above code will output something similar to:
Hash is: {ARGON2I}$argon2i$v=19$m=65536,t=4,p=1$d1JMUXVHSUtLTGhxYnowVQ$4raz6DDUbtRysi+1ZTdNL3L5j4tcSYnzWxyLVDtFjKc
Verify: true
Verify fails with: false
ChangeLog
2021/07/03 - Initial release / copying of code from https://github.com/postfixadmin/postfixadmin ...
postfixadmin/password-hashing 适用场景与选型建议
postfixadmin/password-hashing 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22.64k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2021 年 07 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 postfixadmin/password-hashing 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 postfixadmin/password-hashing 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 22.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2021-07-05