pbkdf2_key_derivation v1.0.3 Pbkdf2KeyDerivation View Source
Link to this section Summary
Functions
Derives a key of length key_bytes
for pass
,
using algo
and salt
for count
iterations.
Derives a key of length key_bytes
for pass
,
using algo
and salt
for count
iterations.
Link to this section Functions
Link to this function
pbkdf2(algo, pass, salt, count, key_bytes)
View Sourcepbkdf2( :sha | :sha256 | :sha512, binary(), binary(), pos_integer(), pos_integer() ) :: {:error, String.t()} | {:ok, binary()}
Derives a key of length key_bytes
for pass
,
using algo
and salt
for count
iterations.
To raise on error use Pbkdf2KeyDerivation.pbkdf2!/5
Example
iex> Pbkdf2KeyDerivation.pbkdf2(:sha512, "password", "salt", 1000, 64)
{:ok,
<<175, 230, 197, 83, 7, 133, 182, 204, 107, 28, 100, 83, 56, 71, 49, 189, 94,
228, 50, 238, 84, 159, 212, 47, 182, 105, 87, 121, 173, 138, 28, 91, 245,
157, 230, 156, 72, 247, 116, 239, 196, 0, 125, 82, 152, 249, 3, 60, _rest>>}
Link to this function
pbkdf2!(algo, pass, salt, count, key_bytes)
View Sourcepbkdf2!( :sha | :sha256 | :sha512, binary(), binary(), pos_integer(), pos_integer() ) :: binary()
Derives a key of length key_bytes
for pass
,
using algo
and salt
for count
iterations.
To return a tuple instead of raising use Pbkdf2KeyDerivation.pbkdf2/5
Example
iex> Pbkdf2KeyDerivation.pbkdf2(:sha512, "password", "salt", 1000, 64)
<<175, 230, 197, 83, 7, 133, 182, 204, 107, 28, 100, 83, 56, 71, 49, 189, 94,
228, 50, 238, 84, 159, 212, 47, 182, 105, 87, 121, 173, 138, 28, 91, 245,
157, 230, 156, 72, 247, 116, 239, 196, 0, 125, 82, 152, 249, 3, 60, _rest>>