Skip to content
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

Incorporate suite of hash utilities into node #2444

Closed
JavaScriptDude opened this issue Aug 19, 2015 · 7 comments
Closed

Incorporate suite of hash utilities into node #2444

JavaScriptDude opened this issue Aug 19, 2015 · 7 comments
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@JavaScriptDude
Copy link

Following the lead from this closed node.js request here and here, can we please look at the opportunity of adding support for non-crystallographic hash functions into the node core.

There are many usecases where hash functions (CRC or checksums) can be useful for non-crystallographic purposes and adding this will go a long way to extend the use of node.js as a general purpose desktop and server application development language.

To shorten the development effort, it may be best to include an existing cross platform, C or C++ based library that has an appropriate license which contains a wide range of hash functions. To this end, I have done some digging and found that one good candidate is the RHash Project. RHash appears to be small, popular, cross platform, and based on the MIT license. All of this may make RHash a good candidate for the backbone of a checksum library for node.

Regarding where to house checksum libraries, It can either be put under crypto, although this will likely raise some passionate discussion. Another suggestion is to create a new library called hash.

@JavaScriptDude
Copy link
Author

It maybe a much shorter path to add an efficient wrapper for zlib crc32 library as per open issue 7213, However, I would still believe we should be a plan to add a suite of hash functions to node rather than just crc32.

@seishun
Copy link
Contributor

seishun commented Aug 19, 2015

I don't think node core should be bloated with barely-known hash functions, especially if it requires adding another dependency. But exposing CRC32 from zlib would be logical.

I kinda abandoned my previous PR because I preferred to not add CRC32 and Adler32 at all rather than add them to crypto, which has literally nothing to do with checksums. If we can reach agreement where checksum functions belong (I still vote for the zlib module), then I'll gladly rebase and resubmit that PR.

@Fishrock123 Fishrock123 added the feature request Issues that request new features to be added to Node.js. label Aug 19, 2015
@sam-github
Copy link
Contributor

exposing from zlib would be ok, I guess, though it seems unnecessary.

generic crc is easily done as an addon. Mine is probably out of date, and needs to be rewritten with nan, but its here, and supports parameterized CRCs: https://github.com/sam-github/node-bcrc

@mscdex
Copy link
Contributor

mscdex commented Aug 20, 2015

IMHO I think this should stay out of core. There's already lots of choices in CRC modules on npm and elsewhere, some are pure JS and some are addons (one of which is highly optimized for SSE, if you care about that).

@bnoordhuis
Copy link
Member

SIMD support is coming to V8. In 6 to 12 months time you will be able to write implementations that rival native code for speed.

I don't think we have to add anything to core. User land and a little patience will sort it out.

@Fishrock123
Copy link
Contributor

Closing this out, this probably belongs in userland. Let us know if there is anything specific you have trouble building or are unable to!

@JavaScriptDude
Copy link
Author

I understand the direction, and thanks for your time to review.

I have always been skeptical of native vs JS performance and a bit old school on this and I'm always concerned about gyp builds of native code for cross platform, especially windows.

@bnoordhuis - SIMD in node sounds very interesting. Thanks for the info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js.
Projects
None yet
Development

No branches or pull requests

6 participants