Giter VIP home page Giter VIP logo

dev-random-passwords's Introduction

Gem Version

Dev-Random-Passwords

Passwords that need to be used long term and are randomly generated need more randomness than your standard random library. On Linux, Unix or OSX /dev/random can be used to create really secure passwords from random bytes. This gem provides an implementation to do just that.

Installation

Add this line to your application's Gemfile:

gem 'dev-random-passwords'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dev-random-passwords

Usage

From command line

Simply install the gem and run "randompasswords"

$ randompasswords
ci+IUid(QVG1

dev-random-passwords by default creates a 12 character random password with uppercase and lowercase letters, numbers, and special characters. A password with these qualities would take centuries to brute force and ensure that you have very secure random passwords.

Use -l to specify chracter length

$ randompasswords -l 16
U[3wjY?]~h$26s!Q

Use -c to set which character types you want to use (uppercase, lowercase, digits or special)

$ randompasswords -l 16 -c lowercase,uppercase
cxtDCjIaTFmHnlba

Use -i to include certain characters or -e to exclude them

$ randompasswords -c digits -l 54 -e 23456789
010000101100100111000010000111101010011101110010011011

Run "randompasswords -h" for full set of options and description

For programming

Require the gem

require 'dev-random-passwords'

Set up a new instance

rpg = DevRandomPasswords::Generator.new

Set some options for your password

rpg.set_options({'lowercase' => true, 'uppercase' => true, 'digits' => true,  'length' => 18, 'requirements' => {'digits' => true, 'uppercase' => true, 'lowercase' => true}})

Generate a new password

rpg.generate #=> "wdHHzTex47NWFyseN8"

Enjoy!

Contributing

  1. Fork it ( https://github.com/jbsmith86/dev-random-passwords/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

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.