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 3.2.1 to 3.2.2

2

package.json

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

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

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

(function() {
var g = ('undefined' === typeof window ? global : window) || {}
var foolBrowserify = require
_crypto = (
g.crypto || g.msCrypto || foolBrowserify('crypto')
)
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;
// Modern Browsers
if(_crypto.getRandomValues) {
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
return bytes;
}
else if (_crypto.randomBytes) {
return _crypto.randomBytes(size)
}
else
throw new Error(
'secure random number generation not supported by this browser\n'+
'use chrome, FireFox or Internet Explorer 11'
)
}
}())

Sorry, the diff of this file is not supported yet

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