Closed achingbrain closed 6 years ago
@calvinmetcalf thanks for your input - were there any further comments or do you think this can be merged?
I think this can be done with zero copies, let me do some tests
hey take a look at #16, it turns out we can simplify a lot of stuff
Looks fine. I guess the only problem would be if someone's bundler setup doesn't use a TypedArray to back it's Buffer
implementation as that's what crypto.getRandomValues()
requires as an argument.
The original code has the comment in case browserify isn't using the Uint8Array version
above where it creates a Uint8Array
to pass to crypto.getRandomValues()
- I took that to mean someone once thought there was a chance that Buffer
might not be a TypedArray
behind the scenes.
Yeah but we're not using the built in buffer, we're using safe buffer which seems to work on phantom
On Tue, Jul 17, 2018, 7:11 PM Alex Potsides notifications@github.com wrote:
Looks fine. I guess the only problem would be if someone's bundler setup doesn't use a TypedArray https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray to back it's Buffer implementation as that's what crypto.getRandomValues() requires as an argument.
The original code has the comment in case browserify isn't using the Uint8Array version above where it creates a Uint8Array to pass to crypto.getRandomValues() - I took that to mean someone once thought there was a chance that Buffer might not be a TypedArray behind the scenes.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/crypto-browserify/randombytes/pull/15#issuecomment-405757071, or mute the thread https://github.com/notifications/unsubscribe-auth/ABE4nwHefy8jZ3mbb72USySMC42QeJMlks5uHm8hgaJpZM4VElEs .
Should probably remove that comment then?
good call
yeah that comment is gone in the other pull, which I'm going to close this in favor of
Calls
crypto.getRandomValues(buffer)
repeatedly until the request number of bytes have been generated.Will throw an error if fewer than zero or more than the max value of a uint32 bytes are requested in the same way as node.js.
Fixes #14