No commit activity in last 3 years
No release in over 3 years
A library for generating random string
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Secure Random String

A simple helper to generate a secure random string for use as an API token or other such token.

Installation

gem 'secure_random_string', '~> 1.0'

Usage

# Generate a 10 character string consisting of upper & lower case letters and numbers
string = SecureRandomString.new(10)

# Include characters
string = SecureRandomString.new(10, :characters => true)

# Include ? and * in the possible character pool
string = SecureRandomString.new(10, :extra => ['?', '*'])

# Don't include numbers
string = SecureRandomString.new(10, :numbers => false)

# Don't include lowercase letters
string = SecureRandomString.new(10, :lowercase => false)

# Don't include uppercase letters
string = SecureRandomString.new(10, :uppercase => false)