定制 alexandernst/yii2-scrypt 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alexandernst/yii2-scrypt

最新稳定版本:0.0.4

Composer 安装命令:

composer require alexandernst/yii2-scrypt

包简介

Scrypt key derivation function for Yii2

README 文档

README

Scrypt key derivation function for Yii2

To use it just require this extension in your composer.json file:

"alexandernst/yii2-scrypt": "0.0.4",

And then add it to your components configuration in Yii2:

'components' => [
	'Scrypt' => [
		'class' => 'alexandernst\Scrypt\Scrypt'
	],
]

To derivate a key, use the following method:

/**
* Scrypt algorithm
*
* @param  string $password
* @param  string $salt
* @param  int $n CPU/Memory cost parameter, must be larger than 1, a power of 2 and less than 2^(128 * r / 8)
* @param  int $r Block size
* @param  int $p Parallelization parameter, a positive integer less than or equal to ((2^32-1) * hLen) / MFLen where hLen is 32 and MFlen is 128 * r
* @param  int $length Length of the output key
* @throws Exception
* @return string
*/
echo bin2hex(\Yii::$app->Scrypt->calc("plain password", "salt", 8, 8, 16, 32));

This class passes all the tests specified in the documentation.

统计信息

  • 总下载量: 77
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GNU
  • 更新时间: 2015-04-04