Created
June 22, 2022 07:56
-
-
Save somerongit/5ce124ea07bf2743a7241ed95bbc3e41 to your computer and use it in GitHub Desktop.
Password Hashing with bcrypt in Type Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm i bcrypt@5.0.1 @types/bcrypt@3.0.0 | |
import * as bcrypt from "bcrypt" | |
function getHash(password: string): string { | |
const saltRounds = bcrypt.genSaltSync(12) | |
const hash = bcrypt.hashSync(password,saltRounds) | |
return hash | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment