Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@ethersproject/random
Advanced tools
@ethersproject/random is a part of the ethers.js library, which provides utilities for generating cryptographically secure random values. This is particularly useful in blockchain and cryptographic applications where secure randomness is crucial.
Generate Random Bytes
Generates a cryptographically secure random sequence of bytes. The number of bytes is specified as an argument to the function.
const { randomBytes } = require('@ethersproject/random');
const bytes = randomBytes(16);
console.log(bytes);
Generate Random Hex String
Generates a cryptographically secure random sequence of bytes and converts it to a hexadecimal string.
const { randomBytes } = require('@ethersproject/random');
const bytes = randomBytes(16);
const hexString = bytes.toString('hex');
console.log(hexString);
The 'crypto' module in Node.js provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions. It can also generate random bytes using the 'crypto.randomBytes' function, similar to @ethersproject/random.
The 'uuid' package is used to generate RFC4122 UUIDs, which are universally unique identifiers. While it is not specifically for generating random bytes, it provides a way to generate unique identifiers that include random components.
The 'secure-random' package generates cryptographically strong pseudo-random data. It can generate random bytes, hex strings, and other formats, similar to @ethersproject/random.
This sub-module is part of the ethers project.
It contains functions to assist with random numbers.
For more information, see the documentation.
Most users will prefer to use the umbrella package, but for those with more specific needs, individual components can be imported.
const {
shuffled,
randomBytes
} = require("@ethersproject/random");
MIT License
FAQs
Random utility functions for ethers.
The npm package @ethersproject/random receives a total of 692,877 weekly downloads. As such, @ethersproject/random popularity was classified as popular.
We found that @ethersproject/random 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.