Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

crng

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crng

Generate random values from a crypto RNG source

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

crng

Generate random values from a cryptographicaly-secure random number generator in Node.js. Uses the crypto module.

Generators

cryptoRandom01

Generate a value between 0 (inclusive) and 1 (exclusive).

import {cryptoRandom01} from "crng";
// const {cryptoRandom01} = require("crng");

let val: number = cryptoRandom01();

cryptoRandomDouble

Generate a number that is not infinite and not NaN.

import {cryptoRandomDouble} from "crng";
// const {cryptoRandomDouble} = require("crng");

let val: number = cryptoRandomDouble();

cryptoRandomHex

Generate a string containing hexadecimal characters with n bytes of entropy (defaults to 8).

Note that the length of the resulting value is double the entropy amount.

import {cryptoRandomHex} from "crng";
// const {cryptoRandomHex} = require("crng");

let val: string = cryptoRandomHex(8);
console.assert(val.length === 16);

Keywords

FAQs

Package last updated on 03 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc