Skip to content

Webpack compatibility #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2015
Merged

Webpack compatibility #41

merged 1 commit into from
Jun 21, 2015

Conversation

squirrelsama
Copy link
Contributor

Hey @rzcoder

I was wondering about the choice of write/end/read as opposed to update/digest. Were there different performance/memory characteristics between using the stream functions instead of the hash functions? Or some implementation detail between the two that I'm missing? Or did you just decide to use the stream methods because they're the new ones (totally understandable)?

It appears that these are not going to be deprecated soon, the nodejs docs say "The legacy update and digest methods are also supported." https://nodejs.org/api/crypto.html#crypto_class_hash

This issue came up for me because webpack apparently has a problem where their implementations of the nodejs hash functions are not streams (or for some other reason don't implement write/end/read -- it's a harder to decipher their code than yours). So if I wanted to use the OAEP encryption scheme (you bet I do!) with node-rsa and webpack, one of those codebases need to change.

Worth noting, in Scheme.prototype.encPad you use update/digest as well.

Would you consider accepting this change?

@squirrelsama
Copy link
Contributor Author

For what it's worth, here's a demonstration showing equivalence

> var c = require('crypto')
undefined
> var h1 = c.createHash('sha1')
undefined
> var h2 = c.createHash('sha1')
undefined
> h1.write('a')
true
> h1.end('b')
undefined
> h1.read()
<Buffer da 23 61 4e 02 46 9a 0d 7c 7b d1 bd ab 5c 9c 47 4b 19 04 dc>
> h2.update('a')
{ _handle: {}, _options: undefined }
> h2.update('b')
{ _handle: {}, _options: undefined }
> h2.digest()
<Buffer da 23 61 4e 02 46 9a 0d 7c 7b d1 bd ab 5c 9c 47 4b 19 04 dc>

rzcoder added a commit that referenced this pull request Jun 21, 2015
@rzcoder rzcoder merged commit 2196faf into rzcoder:master Jun 21, 2015
@rzcoder
Copy link
Owner

rzcoder commented Jun 21, 2015

No big difference in this case. I'll accept if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants