Closed ghost closed 5 years ago
This issue tracker is for reporting bugs in node core and submitting feature requests for node core.
General help questions should be posted to the nodejs/help issue tracker instead.
Issues with third-party modules, npm, or other tools that use node, should be posted to the appropriate issue tracker for that project, unless it can be proven that the issue is in fact with node core and not the module/tool in question.
Hello there,
I am trying to create a simple Hash using SHA256. While testing it, I am getting following error:
TypeError: cryptoHash is not a function
**Here is my code:
crypto-hash.js**
`const crypto = require("crypto");
const cryptoHash = (...inputs) => { const hash = crypto.createHash("sha256"); hash.update(inputs.sort().join(" ")); return hash.digest("hex"); };
module.export = cryptoHash; `
Testcase:
crypto-hash.test.js
`const cryptoHash = require("./crypto-hash");
describe("cryptoHash()", () => { it("produces same hash with same input in any order", () => { expect(cryptoHash("one", "two", "three")).toEqual( cryptoHash("three", "one", "two") ); }); }); `
My versions of node and npm:
**npm -v 6.5.0
node -v v8.11.3**
Regards, Arindam