pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/browserify/randombytes/pull/41/files

ps://github.githubassets.com/assets/primer-primitives-6da842159062d25e.css" /> Mark package as side effect free by szacskesz · Pull Request #41 · browserify/randombytes · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,14 @@ const MAX_BYTES = 65536
// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
const MAX_UINT32 = 4294967295

function oldBrowser () {
throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
}

const _global = typeof globalThis !== 'undefined' ? globalThis : global
const crypto = _global.crypto || _global.msCrypto
export function randomBytes (size, cb) {
const _global = typeof globalThis !== 'undefined' ? globalThis : global
const crypto = _global.crypto || _global.msCrypto

if (crypto && crypto.getRandomValues) {
module.exports = randomBytes
} else {
module.exports = oldBrowser
}
if (!crypto || !crypto.getRandomValues) {
throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
}

function randomBytes (size, cb) {
// phantomjs needs to throw
if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')

Expand All @@ -47,4 +41,4 @@ function randomBytes (size, cb) {
}

return bytes
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@
"tap-spec": "^5.0.0",
"tape": "^5.2.2",
"zuul": "^3.12.0"
}
},
"sideEffects": false
}
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy