instance method
derive_key_from
Ruby on Rails 7.1.6
Since v7.0.10Signature
derive_key_from(password, length: key_length)
Derives a key from the given password. The key will have a size in bytes of :length (configured Cipher‘s length by default)
The generated key will be salted with the value of ActiveRecord::Encryption.key_derivation_salt
Parameters
-
passwordreq -
lengthkey = key_length
Source
# File activerecord/lib/active_record/encryption/key_generator.rb, line 38
def derive_key_from(password, length: key_length)
ActiveSupport::KeyGenerator.new(password, hash_digest_class: hash_digest_class)
.generate_key(key_derivation_salt, length)
end
Defined in activerecord/lib/active_record/encryption/key_generator.rb line 38
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Encryption::KeyGenerator