class RIMS::Password::HashSource::Entry

Attributes

hash[R]
salt[R]
stretch_count[R]

Public Class Methods

encode(digest, stretch_count, salt, password) click to toggle source
# File lib/rims/passwd.rb, line 129
def self.encode(digest, stretch_count, salt, password)
  salt_password = salt.b + password.b
  digest.update(salt_password)
  stretch_count.times do
    digest.update(digest.digest + salt_password)
  end
  digest.hexdigest
end
new(digest_factory, stretch_count, salt, hash) click to toggle source
# File lib/rims/passwd.rb, line 138
def initialize(digest_factory, stretch_count, salt, hash)
  @digest_factory = digest_factory
  @stretch_count = stretch_count
  @salt = salt
  @hash = hash
end

Public Instance Methods

compare(password) click to toggle source
# File lib/rims/passwd.rb, line 161
def compare(password)
  self.class.encode(@digest_factory.new, @stretch_count, @salt, password) == @hash
end
hash_type() click to toggle source
# File lib/rims/passwd.rb, line 145
def hash_type
  @digest_factory.to_s.sub(/^Digest::/, '')
end
salt_base64() click to toggle source
# File lib/rims/passwd.rb, line 153
def salt_base64
  Protocol.encode_base64(@salt)
end
to_s() click to toggle source
# File lib/rims/passwd.rb, line 157
def to_s
  [ hash_type, @stretch_count, salt_base64, @hash ].join(':')
end