Class: HTAuth::Crypt
Overview
The basic crypt algorithm
Constant Summary
Constants inherited from Algorithm
Algorithm::DEFAULT, Algorithm::EXISTING, Algorithm::SALT_CHARS
Instance Method Summary collapse
- #encode(password) ⇒ Object
-
#initialize(params = {}) ⇒ Crypt
constructor
A new instance of Crypt.
- #prefix ⇒ Object
Methods inherited from Algorithm
algorithm_from_name, algorithms_from_field, #gen_salt, inherited, sub_klasses, #to_64
Constructor Details
#initialize(params = {}) ⇒ Crypt
Returns a new instance of Crypt.
8 9 10 |
# File 'lib/htauth/crypt.rb', line 8 def initialize(params = {}) @salt = params[:salt] || params['salt'] || gen_salt end |
Instance Method Details
#encode(password) ⇒ Object
16 17 18 |
# File 'lib/htauth/crypt.rb', line 16 def encode(password) password.crypt(@salt) end |
#prefix ⇒ Object
12 13 14 |
# File 'lib/htauth/crypt.rb', line 12 def prefix "" end |