What Is Hashing?

How Hashing helps to secure important data.

Data authentication using hashing.
Data security

What is Hashing?

Hashing is a one-way function that maps our data into fixed lengths. It converts any form of data into a unique string of text. Let’s understand with an example-

Paytm - yqegdmvosuiiaycbghjhtslkaiu

What is Salting?

In the above example, we see that the same hash value gets generated for the same string i.e.Paytm, same hash values for password means our accounts are not secure. To overcome this problem we use the Salting algorithm.

Paytm- 8199F17BABFE2A8818ACD86BB39E9E548C479A1B

What is bcrypt?

bcrypt is a node library that hash the passwords. You can read about bcrypt on Wikipedia-

npm install bcrypt --save
Fig-1 Javascript code to hash the string using bcrypt.
Fig-2 The hash value of the password.
  1. $2b$ identifies the version of the bcrypt algorithm.
  2. $10$ 10 is the cost factor(salt rounds) that we pass in the above code example i.e. bcrypt.genSalt(10);. if we add 15 inside the parenthesis then there will be a 15 salt round to generate random salt data.
  3. The third part is the first 22 characters after $ that is the salt string.

Conclusion

With that said, the majority of the time you can and should use the hashing algorithm to secure your data, and moreover, you can use any library to hash the data of the user for better security.

--

--

Full Stack Developer | How I think as a Programmer and Logic that’s it.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Akshay Kumar

Full Stack Developer | How I think as a Programmer and Logic that’s it.