Module: EasyPasswords

Defined in:
lib/easy_passwords/wordlist.rb,
lib/easy_passwords/version.rb,
lib/easy_passwords/easy_passwords.rb

Overview

Public: EasyPasswords is a Ruby implementation of passwdqc’s easy_passwords password generator.

Examples

EasyPasswords.generate
# => "merger4Hick"

EasyPasswords.new.generate
# => "employ-Royal"

EasyPasswords::Generator.new.generate # => “Beige7Jacob2”

EasyPasswords::Generator.new.generate 4 # => “min5”

Defined Under Namespace

Classes: Generator

Constant Summary collapse

VERSION =
"0.4.1"
DEFAULT_MAX_LENGTH =
12
MIN_WORD_LENGTH =
3
MAX_WORD_LENGTH =
6
SEPARATORS =
'-123456789'.freeze

Class Method Summary collapse

Class Method Details

.generate(max_length = DEFAULT_MAX_LENGTH, separators = SEPARATORS) ⇒ Object

Public: Returns a random generated password string.

max_length - max number of characters used in password, it could generate password shorter by 3 characters. separators - list of separators as a String

Example

generate 8 # => “Fun-Crop”

generate 8, ‘01’ # => “Fun0Crop”

generate # => “spate7Coup”

Returns a password string.



44
45
46
# File 'lib/easy_passwords/easy_passwords.rb', line 44

def self.generate(max_length = DEFAULT_MAX_LENGTH, separators = SEPARATORS)
  self::Generator.new(separators).generate max_length
end

.newObject



48
49
50
# File 'lib/easy_passwords/easy_passwords.rb', line 48

def self.new
  self::Generator.new
end