Class: PwdHash::Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/pwdhash/pwdhash.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(realm, password) ⇒ Hash

Returns a new instance of Hash.



55
56
57
58
59
# File 'lib/pwdhash/pwdhash.rb', line 55

def initialize(realm, password)
  @realm, @password = realm, password
  hash!
  remove_base64_pad_character
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



54
55
56
# File 'lib/pwdhash/pwdhash.rb', line 54

def hash
  @hash
end

Instance Method Details

#contains_non_alphanumeric?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/pwdhash/pwdhash.rb', line 63

def contains_non_alphanumeric?
  @password =~ /\W/
end

#sizeObject



60
61
62
# File 'lib/pwdhash/pwdhash.rb', line 60

def size
  @password.length + '@@'.length
end