27cm / password-generator
PHP library for generating easy to remember but hard to guess passwords
Requires
- php: >=5.6.0
- paragonie/random_compat: ^2.0
Requires (Dev)
- phpunit/phpunit: ~4.3.0
This package is not auto-updated.
Last update: 2024-12-07 20:49:36 UTC
README
A flexible and scriptable password generator which generates strong passphrases, inspired by XKCD Comic 936. Generated passwords easy to remember, but hard to quess passwords.
Installing
With Composer:
$ composer require 27cm/password-generator
Basic usage
Library generates phrases from frequently used words:
- English phrases (example "throat fast only idea")
- German phrases (examle "laut welt ganze liter")
- Russian phrases (example "тоже металл пора подача")
- Russian transliterated phrases (example "kater nekiy zabrat dazhe")
Generate password with default length (4 words) and default separator (space).
use TwentySeven\Password\Generator; use TwentySeven\Password\WordList; echo Generator::generateEn(); // => "throat fast only idea" echo Generator::generateDe(); // => "laut welt ganze liter" echo Generator::generateRu(); // => "тоже металл пора подача" echo Generator::generateRuTranslit(); // => "kater nekiy zabrat dazhe" echo TwentySeven\Password\Generator::generateEn(5, '-'); // => "ritual-error-raise-arab-tail" $lists = [ new WordList\En(), new WordList\RuTranslit() ]; echo Generator::generate($lists, 5, '-'); // => "idea-dovod-critic-sever-happy"
Word lists
English
List of 2048 most frequently used English words.
German
List of 2048 most frequently used german words (source). Words with diacritic letters (ä, ö, ü) and eszett (ß) excluded.
Russian
Lists consist of 2048 most frequently used Russain words (source).
Russian Transliterated
List of 2048 transliterated most frequently used Russain words (source). "Hard" to transliterate letters (ь, ъ) excluded.
Security
Library uses CSPRNG for random number generation.