16

I am making use of crypto module in my app. It seems like there is crypto module distributed in nodejs http://nodejs.org/api/crypto.html so do i need to do npm install crypto? what is the difference from https://npmjs.org/package/crypto and nodejs api crypto modules?

gevorg
  • 4,273
  • 4
  • 32
  • 49
Yalamber
  • 6,783
  • 13
  • 57
  • 80
  • 3
    The npm package does all the calculations with JavaScript. The crypto module that comes with node does afaik most of the calculation with a C/C++ module. The npm version could be useful if you have node installation without the crypto module (e.g. `libssl` not installed.) – TheHippo Apr 22 '13 at 11:34
  • Thanks it could be may be answer to my question. you made it clear. thank you – Yalamber Apr 22 '13 at 12:11

1 Answers1

23

If you are using the methods from the Crypto module that comes with NodeJS, i.e. those described on http://nodejs.org/api/crypto.html then no, you do not need to do npm install crypto.

matthewtole
  • 3,027
  • 17
  • 19
  • Are there any differences in these two modules. both look very similar . – Yalamber Apr 22 '13 at 10:15
  • The "official" module is a lot more comprehensive. From what I can tell, there is nothing in the unofficial module that isn't in the official one. What is it you are using the module for? – matthewtole Apr 22 '13 at 10:17
  • I am using it to create hmac signature. So official module is fine i think. Was just confused to see same module in npm. – Yalamber Apr 22 '13 at 10:21
  • 1
    `import {} from "crypto";` or `require("crypto")` – Seph Reed Dec 19 '19 at 18:23