Class: HTAuth::Sha1
Overview
an implementation of the SHA based encoding algorithm as used in the apache htpasswd -s option
Constant Summary
Constant Summary
Constants inherited from Algorithm
Algorithm::DEFAULT, Algorithm::EXISTING, Algorithm::SALT_CHARS
Instance Method Summary (collapse)
- - (Object) encode(password)
-
- (Sha1) initialize(params = {})
constructor
ignore the params.
- - (Object) prefix
Methods inherited from Algorithm
algorithm_from_name, algorithms_from_field, #gen_salt, inherited, sub_klasses, #to_64
Constructor Details
- (Sha1) initialize(params = {})
ignore the params
12 13 |
# File 'lib/htauth/sha1.rb', line 12 def initialize(params = {}) end |
Instance Method Details
- (Object) encode(password)
19 20 21 |
# File 'lib/htauth/sha1.rb', line 19 def encode(password) "#{prefix}#{Base64.encode64(::Digest::SHA1.digest(password)).strip}" end |
- (Object) prefix
15 16 17 |
# File 'lib/htauth/sha1.rb', line 15 def prefix "{SHA}" end |