Class: Pbkdf2

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

Class Method Summary collapse

Class Method Details

.hash_password(password, salt, iterations, algorithm = "sha256", length: 32) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/pbkdf2.rb', line 4

def self.hash_password(password, salt, iterations, algorithm = "sha256", length: 32)
  OpenSSL::KDF.pbkdf2_hmac(
    password,
    salt: salt,
    iterations: iterations,
    length: length,
    hash: algorithm,
  ).unpack1("H*")
end