Created
March 20, 2021 22:53
-
-
Save Khuzha/a864240064b4805a51b70c67315020d8 to your computer and use it in GitHub Desktop.
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
const bcrypt = require('bcrypt'); | |
const src = 'hello world'; | |
const salt = bcrypt.genSaltSync(10); | |
const hash1 = bcrypt.hashSync(src, salt); | |
const hash2 = bcrypt.hashSync(src, salt); | |
console.log(`src = ${src}`); | |
console.log(`salt = ${salt}\n`); | |
console.log(`hash 1 = ${hash1}`); | |
console.log(`hash 2 = ${hash2}\n`); | |
console.log(`compare 1 = ${bcrypt.compareSync(src, hash1)}`); | |
console.log(`compare 2 = ${bcrypt.compareSync(src, hash2)}`); | |
src = hello world
salt = $2b$10$cHO7HgdB744ZvkdXy.vdYe
hash 1 = $2b$10$cHO7HgdB744ZvkdXy.vdYeI8XHBqYcYOv2u8mVsb4EUAmDCQJeIiS
hash 2 = $2b$10$cHO7HgdB744ZvkdXy.vdYeI8XHBqYcYOv2u8mVsb4EUAmDCQJeIiS
compare 1 = true
compare 2 = true
src = hello world
salt = $2b$10$LoFfv/RCHkVO1leLS8UMwe
hash 1 = $2b$10$LoFfv/RCHkVO1leLS8UMwe.bljq9q5/9H.azm7KLuOxxrQylD0Rwy
hash 2 = $2b$10$LoFfv/RCHkVO1leLS8UMwe.bljq9q5/9H.azm7KLuOxxrQylD0Rwy
compare 1 = true
compare 2 = true
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Запустил два раза, ниже результаты: