/password-generator

PHP library for generating easy to remember passwords

Primary LanguagePHPMIT LicenseMIT

PHP password generator

Build Status Total Downloads

PHP library for generating easy to remember, but hard to quess passwords. Inspired by xkcd comic, library generates phrases from frequently used words. Contains different word lists:

  • Common English words (example "idea critic happy chinese")
  • Common Russian words (example "порошок земля нуль платье")
  • Common Russian transliterated (example "vysota razum bumazhka razmer")

Try it!

Install

Via Composer

{
    "require": {
        "barzo/password-generator": "dev-master"
    }
}

Usage

Generate password from English words list with default length (4 words) and default separator (space)

// would output something like "idea critic happy chinese"
echo Barzo\Password\Generator::generateEn();

Generate password with implict word list and params

$wordList = new Barzo\Password\WordList\RuTranslit();

// would output something like "dovod-gore-sever-nomer-druzhka"
echo Generator::generate($wordList, 5, '-');

Word lists

English (WordList\En)

Example - idea critic happy chinese. List of 2048 most frequently used English words (source)

// using short syntax
echo Barzo\Password\Generator::generateEn();

//  equivalent
$wordList = new Barzo\Password\WordList\En();
echo Generator::generate($wordList);

Russian Transliterated (WordList\RuTranslit)

Example - vysota razum bumazhka razmer. List of 2048 most frequently used Russain nouns (source). Words with "hard" to transliterate letters (ц, щ, ь, ъ) excluded.

// using short syntax
echo Barzo\Password\Generator::generateRuTranslit();

//  equivalent
$wordList = new Barzo\Password\WordList\RuTranslit();
echo Generator::generate($wordList);

Russian (WordList\Ru)

Example - порошок земля нуль платье. List of 2048 most frequently used Russain nouns (source).

// using short syntax
echo Barzo\Password\Generator::generateRu();

//  equivalent
$wordList = new Barzo\Password\WordList\Ru();
echo Generator::generate($wordList);

Testing

$ phpunit

Contributing

Pull requests are welcome.

Credits

License

The MIT License (MIT). Please see License File for more information.