Module: Sinatra::Authentication::Password::Hashing

Extended by:
Hashing
Included in:
Hashing
Defined in:
lib/sinatra/authentication/password.rb

Instance Method Summary collapse

Instance Method Details

#check?(password, crypted) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/sinatra/authentication/password.rb', line 27

def check?(password, crypted)
    hash, salt = unserialize(crypted)
    self.hash(password, salt) == hash
end

#encrypt(password, salt = self.generate_salt) ⇒ Object



23
24
25
# File 'lib/sinatra/authentication/password.rb', line 23

def encrypt(password, salt = self.generate_salt)
    serialize(hash(password, salt), salt)
end