module Digest::PBKDF2
PBKDF2 (RFC 8018), the key derivation of SCRAM and of password storage.
Class methods
def self.sha256(password: Bytes | String, salt: Bytes | String, iterations: Int, length: Int) -> Bytes
length bytes derived from password and salt with
HMAC-SHA-256 over iterations rounds. Raises ArgumentError when
iterations is not positive, or length is negative or larger than
RFC 8018 allows ((2^32 - 1) * 32 bytes) or memory holds.
Digest::PBKDF2.sha256("password", "salt", 1, 32).hex[0, 16] # => "120fb6cffcf8b32c"
Digest::PBKDF2.sha256("password", "salt", 0, 32) # raises ArgumentError