Coder Social home page Coder Social logo

getgreenline / secure_random.ex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patricksrobertson/secure_random.ex

0.0 1.0 0.0 133 KB

Convenience library for random base64 strings modeled after my love for Ruby's SecureRandom

License: Apache License 2.0

Elixir 100.00%

secure_random.ex's Introduction

SecureRandom.ex [travis]

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"}]
end

Fetch this motherlover:

mix deps.get

USAGE

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

secure_random.ex's People

Contributors

patricksrobertson avatar jimberlage avatar railsmechanic avatar lowks avatar yoavlt avatar tiagopog avatar ugisozols avatar mus0u avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.