bcrypt or bcryptjs code example

Example 1: bcryptjs

npm i bcryptjs

# yarn
yarn add bcryptjs

Example 2: install bcrypt

npm install bcrypt

Example 3: install bcrypt

npm install bcryptjs

Example 4: bcrypt

>>> import bcrypt
>>> password = b"super secret password"
>>> # Hash a password for the first time, with a randomly-generated salt
>>> hashed = bcrypt.hashpw(password, bcrypt.gensalt())
>>> # Check that an unhashed password matches one that has previously been
>>> # hashed
>>> if bcrypt.checkpw(password, hashed):
...     print("It Matches!")
... else:
...     print("It Does not Match :(")