class PwdHash::Hash2

Constants

DIGEST

Public Class Methods

new(realm, password, salt, iterations) click to toggle source
Calls superclass method PwdHash::Hash::new
# File lib/pwdhash/pwdhash.rb, line 78
def initialize(realm, password, salt, iterations)
  @salt, @iterations = salt, iterations
  super(realm, password)
end

Private Instance Methods

hash!() click to toggle source
# File lib/pwdhash/pwdhash.rb, line 85
def hash!
  # Based on https://github.com/GWuk/PwdHash2/blob/gh-pages/pwdhash2/hashed-password.js#L44
  @hash = Base64.encode64(OpenSSL::PKCS5.pbkdf2_hmac([@password , @salt].join, @realm, @iterations, (2 * size / 3) + 16, DIGEST))
end