Class: HTAuth::Crypt

Inherits:
Algorithm show all
Defined in:
lib/htauth/crypt.rb

Overview

Internal: The basic crypt algorithm

Constant Summary

Constants inherited from Algorithm

Algorithm::CRYPT, Algorithm::DEFAULT, Algorithm::EXISTING, Algorithm::MD5, Algorithm::PLAINTEXT, Algorithm::SALT_CHARS, Algorithm::SHA1

Instance Method Summary collapse

Methods inherited from Algorithm

algorithm_from_name, algorithms_from_field, #gen_salt, inherited, secure_compare, sub_klasses, #to_64

Constructor Details

#initialize(params = {}) ⇒ Crypt

Returns a new instance of Crypt.



7
8
9
# File 'lib/htauth/crypt.rb', line 7

def initialize(params = {})
  @salt = params[:salt] || params['salt'] || gen_salt
end

Instance Method Details

#encode(password) ⇒ Object



15
16
17
# File 'lib/htauth/crypt.rb', line 15

def encode(password)
  password.crypt(@salt)
end

#prefixObject



11
12
13
# File 'lib/htauth/crypt.rb', line 11

def prefix
  ""
end