
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
uuid-key-generator
Advanced tools
Generates random keys with custom size and base-encoding using the RFC4122 v4 UUID algorithm
uuid-token-generator
.Provides a class that generates random keys with custom size and base-encoding using the RFC4122 v4 UUID algorithm. Generated keys are strings that are guaranteed to always be the same length, depending on the bit-size specified for the key.
Great for generating things like API keys and compact IDs.
npm install uuid-key-generator --save
var KeyGenerator = require('uuid-key-generator');
var keygen = new KeyGenerator(); // Default is a 128-bit key encoded in base58
keygen.generateKey();
// -> '4QhmRwHwwrgFqXULXNtx4d'
var keygen2 = new KeyGenerator(256, KeyGenerator.BASE62);
keygen2.generateKey();
// -> 'x6GCX3aq9hIT8gjhvO96ObYj0W5HBVTsj64eqCuVc5X'
Object
Creates a new KeyGenerator instance that generates bitSize
-bit keys encoded using the characters in baseEncoding
.
Param | Default | Type | Description |
---|---|---|---|
[bitSize] | 128 | number | The size of the key to generate in bits. Must be a multiple of 128. |
[baseEncoding] | KeyGenerator.BASE58 | string | One of the KeyGenerator.BASE## constants or a custom string of characters to use to encode the key. |
Example
new KeyGenerator();
new KeyGenerator(256);
new KeyGenerator(KeyGenerator.BASE36);
new KeyGenerator(512, KeyGenerator.BASE62);
new KeyGenerator('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/'); // Custom encoding (base64)
String
0123456789abcdef
String
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
String
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
String
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
String
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!'()*-._~
(all ASCII characters that are not escaped by encodeURIComponent()
)
String
Generates a random key.
Returns: String
- A random key that is always keygen.keyLength
characters long.
Example
var keygen = new KeyGenerator();
keygen.generateKey();
// -> 'vf5NrETkUKCa6FhkyRSazD'
Number
The size of the key that will be generated in bits (the bitSize
value passed to the KeyGenerator
constructor).
String
The set of characters used to encode the key (the baseEncoding
value passed to the KeyGenerator
constructor).
Number
The base of the key that will be generated (which is the number of characters in the baseEncoding
).
Number
The length of the key that will be generated. The generated key will always be this length.
Calculated as such: keyLength = Math.ceil(bitSize / Math.log2(base))
FAQs
Generates random keys with custom size and base-encoding using the RFC4122 v4 UUID algorithm
The npm package uuid-key-generator receives a total of 2 weekly downloads. As such, uuid-key-generator popularity was classified as not popular.
We found that uuid-key-generator 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.