Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is difference between crypto and bcrypt

These modules are required like that

const crypto = require('crypto');
const bcrypt = require('bcrypt');

I'm very confused in between them. I want to know what is difference between them and when it should be used.

like image 882
Rahul Saini Avatar asked Apr 12 '17 18:04

Rahul Saini


1 Answers

The bcrypt module contains an implementation of the bcrypt password hashing algorithm and nothing else.

The built-in crypto module contains many cryptographic primitives such as hashing, symmetric and asymmetric encryption, key exchange and some more. It doesn't contain an implementation of bcrypt, but there is an implementation of PBKDF2 which has a similar goal (password hashing) but not as good as bcrypt.

like image 78
Artjom B. Avatar answered Sep 21 '22 23:09

Artjom B.