Imagine a scenario where you store all the user passwords in plain text in your database, i.e., passwords are stored in the database without any modification. Now some hacker gets access to your database, and they can see any of the user credentials stored in the database and do whatever they want. Congratulation, all your user data is compromised.

What if we could prevent this from happening? What if there was a way to prevent a hacker from accessing your user passwords even if your database is compromised? Yes, there is one called Password Hashing.

What is password hashing?

Hashing is a one-way ticket to data encryption. Hashing performs a one-way transformation on a password, turning the password into another String, called the hashed password. Hashing is called one way because it’s practically impossible to get the original text from a hash.

Prerequisites

Before moving on, I am assuming you have some idea about the following:

  • Working with Node Ecosystem
  • A brief idea about MongoDB
  • and Some JavaScript Knowledge

Make sure you have the following installed on your system to move forward with the blog

  • NodeJS and npm
  • MongoDB

Let’s implement passwords hashing in our node application!

#nodejs #javascript #bcrypt

Password Hashing in Node.js using Bcrypt
28.40 GEEK