Class: HTAuth::Crypt

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

Overview

The basic crypt algorithm

Constant Summary

Constant Summary

Constants inherited from Algorithm

Algorithm::DEFAULT, Algorithm::EXISTING, Algorithm::SALT_CHARS

Instance Method Summary (collapse)

Methods inherited from Algorithm

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

Constructor Details

- (Crypt) initialize(params = {})

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

- (Object) encode(password)



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

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

- (Object) prefix



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

def prefix
        ""
end