Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-forge

Package Overview
Dependencies
Maintainers
3
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-forge - npm Package Compare versions

Comparing version 0.2.8 to 0.2.9

51

js/prng.js

@@ -248,21 +248,38 @@ /**

function defaultSeedFile(needed) {
// use window.crypto.getRandomValues strong source of entropy if
// available
// use window.crypto.getRandomValues strong source of entropy if available
var getRandomValues = null;
if(typeof window !== 'undefined') {
if(window.crypto && window.crypto.getRandomValues) {
getRandomValues = function(arr) {
return window.crypto.getRandomValues(arr);
};
}
else if(window.msCrypto && window.msCrypto.getRandomValues) {
getRandomValues = function(arr) {
return window.msCrypto.getRandomValues(arr);
};
}
}
var b = forge.util.createBuffer();
if(typeof window !== 'undefined' &&
window.crypto && window.crypto.getRandomValues) {
var entropy = new Uint32Array(needed / 4);
try {
window.crypto.getRandomValues(entropy);
for(var i = 0; i < entropy.length; ++i) {
b.putInt32(entropy[i]);
if(getRandomValues) {
while(b.length() < needed) {
// max byte length is 65536 before QuotaExceededError is thrown
// http://www.w3.org/TR/WebCryptoAPI/#RandomSource-method-getRandomValues
var count = Math.max(1, Math.min(needed - b.length(), 65536) / 4);
var entropy = new Uint32Array(Math.floor(count));
try {
getRandomValues(entropy);
for(var i = 0; i < entropy.length; ++i) {
b.putInt32(entropy[i]);
}
}
catch(e) {
/* only ignore QuotaExceededError */
if(!(typeof QuotaExceededError !== 'undefined' &&
e instanceof QuotaExceededError)) {
throw e;
}
}
}
catch(e) {
/* Mozilla claims getRandomValues can throw QuotaExceededError, so
ignore errors. In this case, weak entropy will be added, but
hopefully this never happens.
https://developer.mozilla.org/en-US/docs/DOM/window.crypto.getRandomValues
However I've never observed this exception --@evanj */
}
}

@@ -295,3 +312,3 @@

return b.getBytes();
return b.getBytes(needed);
}

@@ -298,0 +315,0 @@ // initialize seed file APIs

{
"name": "node-forge",
"version": "0.2.8",
"version": "0.2.9",
"description": "JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilties.",

@@ -5,0 +5,0 @@ "homepage": "http://github.com/digitalbazaar/forge",

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