Module: Shield::Password
- Defined in:
- lib/shield/password.rb,
lib/shield/password/pbkdf2.rb,
lib/shield/password/simple.rb
Defined Under Namespace
Class Method Summary collapse
- .check(password, encrypted) ⇒ Object
- .encrypt(password, salt = generate_salt) ⇒ Object
- .generate_salt ⇒ Object
- .strategy ⇒ Object
- .strategy=(s) ⇒ Object
Class Method Details
.check(password, encrypted) ⇒ Object
20 21 22 |
# File 'lib/shield/password.rb', line 20 def self.check(password, encrypted) strategy.check(password, encrypted) end |
.encrypt(password, salt = generate_salt) ⇒ Object
16 17 18 |
# File 'lib/shield/password.rb', line 16 def self.encrypt(password, salt = generate_salt) strategy.encrypt(password, salt) end |
.generate_salt ⇒ Object
24 25 26 |
# File 'lib/shield/password.rb', line 24 def self.generate_salt Digest::SHA512.hexdigest(Time.now.to_f.to_s)[0, 64] end |
.strategy ⇒ Object
12 13 14 |
# File 'lib/shield/password.rb', line 12 def self.strategy @strategy ||= Shield::Password::Simple end |
.strategy=(s) ⇒ Object
8 9 10 |
# File 'lib/shield/password.rb', line 8 def self.strategy=(s) @strategy = s end |