Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
awesome-crypto
Advanced tools
Generates secure random numbers using crypto.randomBytes()
. Numbers can be of any magnitude and in any base from 2 to 64.
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.
Install with yarn:
$ yarn add awesome-crypto
Call the function passing the number of required bits, and the radix of the output.
const { crypto } = require('awesome-crypto'); // import { crypto } from 'awesome-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('awesome-crypto'); // import { Radix } from 'awesome-crypto'
crypto(160, Radix.base64);
number
number
string
Generates a cryptographic string given an amount of bits and a base radix
enum
Possible options to use as the radix
Kind: global enum
Properties
Name | Type |
---|---|
16 | Radix.base16 |
32 | Radix.base32 |
58 | Radix.base58 |
64 | Radix.base64 |
number
number
string
Generates a cryptographic string given an amount of bits and a base radix
Kind: global function
Returns: string
- The cryptographic string
Param | Type | Default | Description |
---|---|---|---|
[bits] | number | DEFAULT_BITS | The amount of bits to generate |
[radix] | Radix | DEFAULT_RADIX | The radix to generate for |
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Copyright © 2019, Favna. Released under the MIT License.
This project is open source and always will be, even if I don't get donations. That said, I know there are people out there that may still want to donate just to show their appreciation so this is for you guys. Thanks in advance!
I accept donations through PayPal, BitCoin, Ethereum and LiteCoin. You can use the buttons below to donate through your method of choice
Donate With | QR | Address |
---|---|---|
Donate with PayPal | ||
1E643TNif2MTh75rugepmXuq35Tck4TnE5 | ||
0xF653F666903cd8739030D2721bF01095896F5D6E | ||
LZHvBkaJqKJRa8N7Dyu41Jd1PDBAofCik6 |
FAQs
Secure random numbers of any size in any base
The npm package awesome-crypto receives a total of 7 weekly downloads. As such, awesome-crypto popularity was classified as not popular.
We found that awesome-crypto demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.