New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@favware/crypto

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@favware/crypto

Secure random numbers of any size in any base

  • 2.0.0-canary.0
  • canary
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35
increased by250%
Maintainers
2
Weekly downloads
 
Created
Source

logo

@favware/crypto

Easily generate a random cryptographic


Project Status

GitHub Codecov

Bundle Sizes

npm bundle size npm bundle size npm

Social Media and Donations

Join Discord server Twitter Follow Patreon Donate PayPal Donate


This package is a full rework of my old package csprng-64 but now far better. I decided to release it as a completely separate package and deprecate the previous one as the entire code base was changed and I wasn't fond of the previous name either.

Key Features

  • Generates secure random numbers using crypto.randomBytes(). Numbers can be of any magnitude and in any base from 2 to 64.
  • Typesafe
  • Bundled with Rollup for maximum size reduction (only 1kB minified + gzipped!), ES module support and browser support
  • Generated TypeScript declarations
  • Treeshakeable in Webpack

Install

Install with yarn or npm:

yarn add @favware/crypto

# npm install @favware/crypto

Usage

Call the function passing the number of required bits, and the radix of the output.

const { crypto } = require('@favware/crypto');
// import crypto from '@favware/crypto';

// Takes a bit length and base parameter
// base examples are base64 or base32
crypto(160, 64);

// You can also import the predefined Radix's so you can be sure you're using a supported radix
const { Radix } = require('@favware/crypto');
// import Radix from '@favware/crypto'
crypto(160, Radix.base64);

API Documentation

Keywords

FAQs

Package last updated on 06 May 2020

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