emn178 / js-sha3

A simple SHA-3 / Keccak hash function for JavaScript supports UTF-8 encoding.
MIT License
345 stars 85 forks source link

npm install js-sha3@0.5.3 doesn't work in Browser #8

Closed kartojal closed 5 years ago

kartojal commented 7 years ago

The NPM package js-sha3 at 0.5.3 version doesn't work in Browser (client-side). For importing the node package to client side, i'm using meteor-node-stubs package (https://github.com/meteor/node-stubs), it's a Browserify implementation for Meteor.

When requiring/importing the sha3_512 method, i only receive an empty object.

Server side works as intended.

The last version, 0.5.2, works like a charm when called in the Browser via meteor-node-stubs. So my actual fix is use that previous version. Can you point me why doesn't import to client now? Could be incompatibilities with meteor-node-stubs?

Thanks

emn178 commented 7 years ago

Hi, I updated Node.js env detection in 0.5.3. It seems to cause your problem. I guess meteor not run in a Node.js env. I changed detection to CommonJS in 0.5.4. It should work. Please help me to try if it fix this problem. Thanks.

fanatid commented 7 years ago

@kartojal you also can try https://github.com/cryptocoinjs/keccak