Search code examples
javascriptnode.jsencryptionbcryptcryptojs

Crypto vs Bcrypt for Specific Data


I am currently building a 'Renters Portal' application with Node.js and I would like to encrypt the users "Applications" for renting a house. I am new to encryption and hope someone could explain whether Bcrypt or Crypto would be better in this instance.

I am currently using Crypto and it seems to be working fine, however, from a security standpoint, I would like to know if changing it to Bcrypt would be better.

From the research that I have gathered, I see that Bcrypt is good for passwords due to the hashing, but that is the extent of it. So is it fair to say that Bcrypt is good for data in which you are not returning data back to the client (i.e. passwords)?


Solution

  • Bcrypt is a hashing function as stated in Wikipedia and README of its npm package. And it is really a good one.

    Node.js' built-in crypto library on the other hand provides various kinds of encryption/hashing techniques.

    If you plan to encrypt the "applications" in a reversible manner, use crypto, otherwise go with bcrypt.