定制 adgodev/xkpasswd-php 二次开发

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

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

adgodev/xkpasswd-php

Composer 安装命令:

composer require adgodev/xkpasswd-php

包简介

Memorable password generator

README 文档

README

Memorable password generator, inspired by a PERL module powering xkpasswd.net/s/

Based heavily on the xkpasswd-node package. Also a nod to battery-staple for the inspiration.

Install

composer require adgodev/xkpasswd-php

Usage

You can use xkpasswd as a module in your application.

EXAMPLES

use Adgodev\Xkpasswd\PasswordGenerator;

PasswordGenerator::generate();

// valuable=bear=difference=53

PasswordGenerator::generate([
    'complexity' => 5,
    'separators' => '#+-'
]);

// addition#wheat#congress#manner#lonely#20

PasswordGenerator::generate([
    'wordList' => 'myWordList.json'
]);

// apple#grape#banana#40

Options

You can specify complexity argument in accordance with complexity levels table. Defaults to 2.

If specified pattern argument overrides the pattern derived from complexity level.

If separators are provided they are used instead of the standard set (see complexity levels). One separator is used per password, picked randomly from the provided set.

You can set transform option to alternate or uppercase to trigger case transformation.

Finally if you'd like to use a custom list of words you can provide it as a JSON file, text file or an array via wordList function.

EXAMPLE Default behaviour

use Adgodev\Xkpasswd\PasswordGenerator;

PasswordGenerator::generate();

// hide+threw+money+61

EXAMPLE Specify complexity

use Adgodev\Xkpasswd\PasswordGenerator;

PasswordGenerator::generate([
    'complexity' => 5
]);

// join=industrial=wide=direction=lungs=16

PasswordGenerator::generate([
    'complexity' => 6
]);

// 57!FIFTHLY!astronauts!AFFECTEDLY!nymphs!TRUSTLESSNESSES!06

EXAMPLE Specify custom pattern

use Adgodev\Xkpasswd\PasswordGenerator;

PasswordGenerator::generate([
    'pattern' => 'wdwd'
]);

// adjective3solar6

EXAMPLE Specify custom word list / dictionary

use Adgodev\Xkpasswd\PasswordGenerator;

PasswordGenerator::generate([
    'wordList' => 'myWordList.json'
]);

// orange.apple.banana
use Adgodev\Xkpasswd\PasswordGenerator;

PasswordGenerator::generate([
    'wordList' => 'myWordList.txt'
]);

// kiwi-strawberry-grape

Patterns

Patterns can consist of any combination of words, digits and separators. The first letters (w, d and s respectively) are used in pattern string provided to the password generation function.

For example:

  • w will return a single word (i.e. demographics). Use w for lowercase and W for uppercase.
  • wsd will return a word and a digit, separated by one of the permitted separators (i.e. storm#7)
  • wswsdd will return two words followed by a two digit number, all with separators between (i.e. delates+dissembled+16)

Complexity levels

There are 6 complexity levels specified which can be used to provide default patterns as well as trigger additional features, such as alternate casing between words and expanded sets of separators.

Complexity Pattern Separators
1 wsw #.-=+_
2 wswsw #.-=+_
3 wswswsdd #.-=+_
4 wswswswsdd #.-=+_
5 wswswswswsd #.-=+_!$*:~?
6 ddswswswswswsdd #.-=+_!$*:~?%^&;

In addition level 6 alternates upper and lower case between words.

Release notes

v1.0.0

Initial release

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2020-03-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固