All Projects → jonschlinkert → Randomatic

jonschlinkert / Randomatic

Licence: mit
Easily generate random strings like passwords, with simple options for specifying a length and for using patterns of numeric, alpha-numeric, alphabetical, special or custom characters. (the original "generate-password")

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Randomatic

secrets.clj
A library designed to generate cryptographically strong random numbers.
Stars: ✭ 64 (-57.05%)
Mutual labels:  random, password
javascript-strong-password-generator
JavaScript Strong Password Generator: based on Jeff Atwood's Post "Password Rules Are Bullshit".
Stars: ✭ 21 (-85.91%)
Mutual labels:  random, password
Random Password Generator
Automatic random password generator class for PHP
Stars: ✭ 9 (-93.96%)
Mutual labels:  random, password
MlkPwgen
Secure random password generator for .NET and PowerShell
Stars: ✭ 57 (-61.74%)
Mutual labels:  random, password
Pgen
Command-line passphrase generator
Stars: ✭ 68 (-54.36%)
Mutual labels:  random, password
Passwordstrengthbundle
Symfony Password strength and blacklisting validator bundle
Stars: ✭ 123 (-17.45%)
Mutual labels:  password
Pwgen
macOS password generator
Stars: ✭ 130 (-12.75%)
Mutual labels:  password
Random Image
随机图片服务
Stars: ✭ 118 (-20.81%)
Mutual labels:  random
Keepassxc
KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
Stars: ✭ 11,623 (+7700.67%)
Mutual labels:  password
Is my password pwned
How often does your password appear in the Pwned Passwords database? Uses the k-anonymity API.
Stars: ✭ 148 (-0.67%)
Mutual labels:  password
Generatedata
A powerful, feature-rich, random test data generator.
Stars: ✭ 1,883 (+1163.76%)
Mutual labels:  random
Libchaos
Advanced library for randomization, hashing and statistical analysis (devoted to chaos machines). 🔬
Stars: ✭ 1,619 (+986.58%)
Mutual labels:  random
Password4j
Password4j is a user-friendly cryptographic library that supports Argon2, Bcrypt, Scrypt, PBKDF2 and various cryptographic hash functions.
Stars: ✭ 124 (-16.78%)
Mutual labels:  password
Wavecrack
Wavestone's web interface for password cracking with hashcat
Stars: ✭ 135 (-9.4%)
Mutual labels:  password
Gosecretsdump
Dump ntds.dit really fast
Stars: ✭ 122 (-18.12%)
Mutual labels:  password
Pandemonium
Typical random-related functions for JavaScript and TypeScript.
Stars: ✭ 144 (-3.36%)
Mutual labels:  random
Fakedata
Haskell Library for producing quality fake data
Stars: ✭ 118 (-20.81%)
Mutual labels:  random
Passpwn
See if your passwords in pass has been breached.
Stars: ✭ 130 (-12.75%)
Mutual labels:  password
Gofakeit
Random fake data generator written in go
Stars: ✭ 2,193 (+1371.81%)
Mutual labels:  random
Baba Core
Mini-language for creating random text generators.
Stars: ✭ 127 (-14.77%)
Mutual labels:  random

randomatic NPM version NPM monthly downloads NPM total downloads Linux Build Status

Generate randomized strings of a specified length using simple character sequences. The original generate-password.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your ❤️ and support.

Install

Install with npm:

$ npm install --save randomatic

Usage

var randomize = require('randomatic');

API

randomize(pattern, length, options);
randomize.isCrypto;
  • pattern {String}: (required) The pattern to use for randomizing
  • length {Number}: (optional) The length of the string to generate
  • options {Object}: (optional) See available options
  • randomize.isCrypto will be true when a cryptographically secure function is being used to generate random numbers. The value will be false when the function in use is Math.random.

pattern

The pattern to use for randomizing

Patterns can contain any combination of the below characters, specified in any order.

Example:

To generate a 10-character randomized string using all available characters:

randomize('*', 10);
//=> 'x2_^-5_T[$'

randomize('Aa0!', 10);
//=> 'LV3u~BSGhw'
  • a: Lowercase alpha characters (abcdefghijklmnopqrstuvwxyz')
  • A: Uppercase alpha characters (ABCDEFGHIJKLMNOPQRSTUVWXYZ')
  • 0: Numeric characters (0123456789')
  • !: Special characters ([email protected]#$%^&()_+-={}[];\',.)
  • *: All characters (all of the above combined)
  • ?: Custom characters (pass a string of custom characters to the options)

length

The length of the string to generate

Examples:

  • randomize('A', 5) will generate a 5-character, uppercase, alphabetical, randomized string, e.g. KDJWJ.
  • randomize('0', 2) will generate a 2-digit random number
  • randomize('0', 3) will generate a 3-digit random number
  • randomize('0', 12) will generate a 12-digit random number
  • randomize('A0', 16) will generate a 16-character, alpha-numeric randomized string

If length is left undefined, the length of the pattern in the first parameter will be used. For example:

  • randomize('00') will generate a 2-digit random number
  • randomize('000') will generate a 3-digit random number
  • randomize('0000') will generate a 4-digit random number...
  • randomize('AAAAA') will generate a 5-character, uppercase alphabetical random string...

These are just examples, see the tests for more use cases and examples.

options

These are options that can be passed as the third argument.

chars

Type: String

Default: undefined

Define a custom string to be randomized.

Example:

  • randomize('?', 20, {chars: 'jonschlinkert'}) will generate a 20-character randomized string from the letters contained in jonschlinkert.
  • randomize('?', {chars: 'jonschlinkert'}) will generate a 13-character randomized string from the letters contained in jonschlinkert.

exclude

Type: String|Array

Default: undefined

Specify a string or array of characters can are excluded from the possible characters used to generate the randomized string.

Example:

  • randomize('*', 20, { exclude: '0oOiIlL1' }) will generate a 20-character randomized string using all of possible characters except for 0oOiIlL1.

Usage Examples

  • randomize('A', 4) (whitespace insenstive) would result in randomized 4-digit uppercase letters, like, ZAKH, UJSL... etc.
  • randomize('AAAA') is equivalent to randomize('A', 4)
  • randomize('AAA0') and randomize('AA00') and randomize('A0A0') are equivalent to randomize('A0', 4)
  • randomize('aa'): results in double-digit, randomized, lower-case letters (abcdefghijklmnopqrstuvwxyz)
  • randomize('AAA'): results in triple-digit, randomized, upper-case letters (ABCDEFGHIJKLMNOPQRSTUVWXYZ)
  • randomize('0', 6): results in six-digit, randomized numbers (0123456789)
  • randomize('!', 5): results in single-digit randomized, valid non-letter characters (`[email protected]#$%^&()_+-={}[]
  • randomize('A!a0', 9): results in nine-digit, randomized characters (any of the above)

The order in which the characters are defined is insignificant.

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running Tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test
Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Related projects

You might also be interested in these projects:

  • pad-left: Left pad a string with zeros or a specified string. Fastest implementation. | homepage
  • pad-right: Right pad a string with zeros or a specified string. Fastest implementation. | homepage
  • repeat-string: Repeat the given string n times. Fastest implementation for repeating a string. | homepage

Contributors

Commits Contributor
56 jonschlinkert
6 doowb
4 kivlor
2 realityking
2 ywpark1
1 TrySound
1 drag0s
1 paulmillr
1 sunknudsen
1 faizulhaque-tp
1 michaelrhodes

Author

Jon Schlinkert

License

Copyright © 2018, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.8.0, on October 23, 2018.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].