Class: Passwd::Password
- Inherits:
-
Object
- Object
- Passwd::Password
- Defined in:
- lib/passwd/password.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
-
#salt_hash ⇒ Object
Returns the value of attribute salt_hash.
-
#salt_text ⇒ Object
Returns the value of attribute salt_text.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #==(password) ⇒ Object
-
#initialize(options = {}) ⇒ Password
constructor
A new instance of Password.
Constructor Details
#initialize(options = {}) ⇒ Password
Returns a new instance of Password.
7 8 9 10 11 12 |
# File 'lib/passwd/password.rb', line 7 def initialize(={}) @text = .fetch(:password, Passwd.create) @salt_text = .fetch(:salt_text, Time.now.to_s) @salt_hash = Passwd.hashing(@salt_text) @hash = Passwd.hashing("#{@salt_hash}#{@text}") end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
5 6 7 |
# File 'lib/passwd/password.rb', line 5 def hash @hash end |
#salt_hash ⇒ Object
Returns the value of attribute salt_hash.
5 6 7 |
# File 'lib/passwd/password.rb', line 5 def salt_hash @salt_hash end |
#salt_text ⇒ Object
Returns the value of attribute salt_text.
5 6 7 |
# File 'lib/passwd/password.rb', line 5 def salt_text @salt_text end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/passwd/password.rb', line 5 def text @text end |