Module: Shield::Password::Simple

Extended by:
Simple
Included in:
PBKDF2, Simple
Defined in:
lib/shield/password/simple.rb

Instance Method Summary collapse

Instance Method Details

#check(password, encrypted) ⇒ Object



10
11
12
13
14
# File 'lib/shield/password/simple.rb', line 10

def check(password, encrypted)
  sha512, salt = encrypted.to_s[0..127], encrypted.to_s[128..-1]

  digest(password, salt) == sha512
end

#encrypt(password, salt) ⇒ Object



6
7
8
# File 'lib/shield/password/simple.rb', line 6

def encrypt(password, salt)
  digest(password, salt) + salt
end