SecureRandom.ex ![[travis]](https://img.hex.pm/fetch/68d7980c95db9c2f47bf6bcc5df171ea8221ceac/68747470733a2f2f7472617669732d63692e6f72672f7061747269636b73726f62657274736f6e2f7365637572655f72616e646f6d2e65782e706e67)
SecureRandom is an elixir module loosely based on Ruby’s SecureRandom. I needed urlsafe, random, base64 strings and UUID generation, so I ported over what I needed :).
This gets its random from Erlang’s strong_rand_bytes/1 and is strongly based
from this gist. I had to remove some
things that didn’t make it to Elixir 1.0, and cut the stuff that I do not
currently have use for.
Will accept PR’s to flesh out further.
INSTALL
Add this to your mix.exs:
defp deps do
[{:secure_random, "~> 0.5"}]
endFetch this motherlover:
mix deps.getUSAGE
UUID:
SecureRandom.uuid # => "e8bc6fde-3c11-cc2e-903b-745221154d8a"base64 string:
SecureRandom.base64(8) # => "VsifwaD2HCk="urlsafe_base64 string:
SecureRandom.urlsafe_base64 #=> "WAut546EWdXM3O_9sJGvmQ"AUTHOR
Brought to you by Adequate Kitchen which is a vague way saying Patrick Robertson.
LICENSE
Apache 2.0