MD5 module in node.js uses a message-digest algorithm and it is a widely used hash function producing a 128-bit hash value. Password hashing is an important concept because, in the database, the actual password should not be stored as its a bad practice and also make the system less secure, so the password is stored in hashed form into the database which makes the system more secured.
- It’s easy to get started and easy to use.
- It is widely used and popular module for hashing password.
- It produces a 128-bit hash value.
Installation of MD5 module:
- You can visit the link Install MD5 module. You can install this package by using the following command.
npm install md5
- After installing multer you can check your md5 version in command prompt using the command.
npm version md5
- After that, you can create a folder and add a file for example index.js, To run this file you need to run the following command.
- Requiring module: You need to include md5 module in your file by using these lines.
var md5 = require('md5');
Steps to run the program:
- The project structure will look like this:
- Make sure you have install md5 module using following commands:
npm install md5
- Run index.js file using below command:
So this is how you can hash password in node js using MD5 module. There are other modules in the market for hashing like Bcrypt, Crypto, etc.
- How to Sign In with raw password when password store in the database are hashed form in Node.js ?
- Nodejs | Automatic restart NodeJs server with nodemon
- How to compare password and confirm password inputs using express-validator ?
- Nodejs | DNS
- Quadratic Probing in Hashing
- How to use bcrypt for hashing passwords in PHP?
- Web-Socket in NodeJS
- Nodejs | DNS | setServers()
- Nodejs | Jimp
- Nodejs | GM drawEllipse() Function
- Encrypting Data in NodeJS
- Nodejs | GM drawCircle() Function
- Nodejs | GM drawBezier() Function
- Dockerizing a simple Nodejs app
- Nodejs | GM orderedDither() Function
- Nodejs | GM paint() Function
- Nodejs | Web Crawling using Cheerio
- Nodejs | GM drawRectangle() Function
- Nodejs | GM drawPolygon() Function
- Difference between NodeJS and AngularJS
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.