Module: BCryptPbkdf
- Defined in:
- lib/bcrypt_pbkdf.rb,
ext/mri/bcrypt_pbkdf_ext.c
Defined Under Namespace
Classes: Engine
Class Method Summary collapse
-
.key(pass, salt, keylen, rounds) ⇒ Object
generates a key from a password + salt returning a string with keylen bytes that can be used as cryptographic key.
Class Method Details
.key(pass, salt, keylen, rounds) ⇒ Object
generates a key from a password + salt returning a string with keylen bytes that can be used as cryptographic key.
Remember to get a good random salt of at least 16 bytes. Using a higher rounds count will increase the cost of an exhaustive search but will also make derivation proportionally slower.
Example:
rounds = 10
keylen = 64
@key = BCryptPbkdf.key("my secret", "my salt", keylen, rounds)
20 21 22 |
# File 'lib/bcrypt_pbkdf.rb', line 20 def self.key(pass,salt,keylen,rounds) BCryptPbkdf::Engine::__bc_crypt_pbkdf(pass,salt,keylen,rounds) end |