class HTAuth::Sha1

an implementation of the SHA based encoding algorithm as used in the apache htpasswd -s option

Constants

ENTRY_REGEX
PREFIX

Public Class Methods

handles?(password_entry) click to toggle source
# File lib/htauth/sha1.rb, line 14
def self.handles?(password_entry)
  ENTRY_REGEX.match?(password_entry)
end
new(params = {}) click to toggle source

ignore the params

# File lib/htauth/sha1.rb, line 19
def initialize(params = {}) 
end

Public Instance Methods

encode(password) click to toggle source
# File lib/htauth/sha1.rb, line 22
def encode(password)
  "#{PREFIX}#{Base64.encode64(::Digest::SHA1.digest(password)).strip}"
end