class PwdHash::Hash
Attributes
hash[R]
Public Class Methods
new(realm, password)
click to toggle source
# File lib/pwdhash/pwdhash.rb, line 55 def initialize(realm, password) @realm, @password = realm, password hash! remove_base64_pad_character end
Public Instance Methods
contains_non_alphanumeric?()
click to toggle source
# File lib/pwdhash/pwdhash.rb, line 63 def contains_non_alphanumeric? @password =~ /\W/ end
size()
click to toggle source
# File lib/pwdhash/pwdhash.rb, line 60 def size @password.length + '@@'.length end
Private Instance Methods
hash!()
click to toggle source
# File lib/pwdhash/pwdhash.rb, line 67 def hash! @hash = Base64.encode64(OpenSSL::HMAC.digest("MD5", @password, @realm)).strip end
remove_base64_pad_character()
click to toggle source
# File lib/pwdhash/pwdhash.rb, line 70 def remove_base64_pad_character @hash.sub!(/=+$/, '') end