Socket
Socket
Sign inDemoInstall

crypto-browserify

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crypto-browserify - npm Package Compare versions

Comparing version 2.1.10 to 3.0.0

2

package.json

@@ -5,3 +5,3 @@ {

"description": "partial implementation of crypto for the browser",
"version": "2.1.10",
"version": "3.0.0",
"homepage": "https://github.com/dominictarr/crypto-browserify",

@@ -8,0 +8,0 @@ "repository": {

@@ -1,33 +0,10 @@

// Original code adapted from Robert Kieffer.
// details at https://github.com/broofa/node-uuid
(function() {
var _global = this;
var mathRNG, whatwgRNG;
// NOTE: Math.random() does not guarantee "cryptographic quality"
mathRNG = function(size) {
var bytes = new Buffer(size);
var r;
for (var i = 0, r; i < size; i++) {
if ((i & 0x03) == 0) r = Math.random() * 0x100000000;
bytes[i] = r >>> ((i & 0x03) << 3) & 0xff;
}
module.exports = function(size) {
var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array
/* This will not work in older browsers.
* See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
*/
crypto.getRandomValues(bytes);
return bytes;
}
if (_global.crypto && crypto.getRandomValues) {
whatwgRNG = function(size) {
var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array
crypto.getRandomValues(bytes);
return bytes;
}
}
module.exports = whatwgRNG || mathRNG;
}())
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