Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@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 676,426 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.