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

node-random-chars

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-random-chars - npm Package Compare versions

Comparing version 1.0.2 to 2.0.0

.github/workflows/npm-publish.yml

18

index.js

@@ -0,5 +1,15 @@

const crypto = require('crypto');
function generateHash(len) {
var hash = "";
for(; hash.length < len; hash += Math.random().toString(36).substr(2));
return hash.substr(0, len);
const charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
const charSetLength = charSet.length;
let hash = '';
for (let i = 0; i < len; i++) {
const randomBuffer = crypto.randomBytes(1);
const randomIndex = randomBuffer[0] % charSetLength;
hash += charSet[randomIndex];
}
return hash;
}

@@ -14,2 +24,2 @@

}
};
};
{
"name": "node-random-chars",
"version": "1.0.2",
"version": "2.0.0",
"description": "Creates random alphanumeric hash strings with given length",

@@ -5,0 +5,0 @@ "main": "index.js",

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