Module: SonicPass
- Defined in:
- lib/sonic_pass.rb,
lib/sonic_pass/version.rb
Overview
Strong password generator.
Generates strong
Constant Summary collapse
- ALPHANUMERIC_CHARSETS =
Array('A'..'Z') + Array('a'..'z') + Array('0'..'9')
- SPECIAL_CHARSETS =
%w[! @ # $ % ^ & * ( ) - _ = + { } [ ] | : ; " ' < > ? , . /].freeze
- CHARSETS =
ALPHANUMERIC_CHARSETS + SPECIAL_CHARSETS
- VERSION =
'1.0.1'
Class Method Summary collapse
-
.generate(length = 12, count = 1) ⇒ Array<String>
Combine them into a single charset if needed.
Class Method Details
.generate(length = 12, count = 1) ⇒ Array<String>
Combine them into a single charset if needed
22 23 24 25 26 |
# File 'lib/sonic_pass.rb', line 22 def self.generate(length = 12, count = 1) passwords = Array.new(count) { (Array.new(length) { CHARSETS.sample }).join } count == 1 ? passwords[0] : passwords end |