Skip to content
Generate a cryptographically strong random string
Branch: master
Clone or download
Latest commit 02bce8d Apr 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig Require Node.js 8, add TypeScript definition (#3) Apr 9, 2019
.gitattributes Require Node.js 8, add TypeScript definition (#3) Apr 9, 2019
.gitignore Require Node.js 8, add TypeScript definition (#3) Apr 9, 2019
.npmrc Require Node.js 8, add TypeScript definition (#3) Apr 9, 2019
.travis.yml Require Node.js 8, add TypeScript definition (#3) Apr 9, 2019
index.d.ts Require Node.js 8, add TypeScript definition (#3) Apr 9, 2019
index.js Require Node.js 8, add TypeScript definition (#3) Apr 9, 2019
index.test-d.ts Meta tweaks Apr 9, 2019
license Require Node.js 8, add TypeScript definition (#3) Apr 9, 2019
package.json
readme.md
test.js Require Node.js 8, add TypeScript definition (#3) Apr 9, 2019

readme.md

crypto-random-string Build Status

Generate a cryptographically strong random string

Can be useful for creating an identifier, slug, salt, fixture, etc.

Install

$ npm install crypto-random-string

Usage

const cryptoRandomString = require('crypto-random-string');

cryptoRandomString(10);
//=> '2cf05d94db'

API

cryptoRandomString(length)

Returns a hex string.

length

Type: number

Length of the returned string.

Related

License

MIT © Sindre Sorhus

You can’t perform that action at this time.