Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scrogson/key_generator
PBKDF2 implementation for Elixir
https://github.com/scrogson/key_generator
Last synced: about 1 month ago
JSON representation
PBKDF2 implementation for Elixir
- Host: GitHub
- URL: https://github.com/scrogson/key_generator
- Owner: scrogson
- Created: 2014-06-25T07:06:57.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-24T04:40:34.000Z (almost 10 years ago)
- Last Synced: 2024-10-08T18:21:27.849Z (3 months ago)
- Language: Elixir
- Homepage:
- Size: 158 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
KeyGenerator
======KeyGenerator is a [PBKDF2][] implementation for [Elixir][]. Conforming to [rfc2898][].
[PBKDF2]: http://en.wikipedia.org/wiki/PBKDF2
[Elixir]: http://elixir-lang.org
[rfc2898]: http://tools.ietf.org/html/rfc2898It can be used to derive a number of keys for various purposes from a given
secret. This lets applications have a single secure secret, but avoid reusing
that key in multiple incompatible contexts.## Usage
```elixir
defmodule User do
import KeyGeneratordef encrypt_password(password, salt, opts \\ []) do
generate(password, salt, opts) |> to_hex
end
endkey = User.encrypt_password("password", "salt")
# => "f87cbb89d972a9b96f5a9e2068308f06e1cf6421748..."
```### Options
* `:iterations` - defaults to 1000;
* `:length` - a length in octets for the derived key. Defaults to 64;
* `:digest` - an hmac function to use as the pseudo-random function.
Defaults to `:sha`;