chnages
chnages
This commit is contained in:
1 parent
3e22355510
commit
e22a8dc248
71 files changed
+24775
-1
No files matched your search
@@ -0,0 +1,19 @@
|
||||
// ============================================================
|
||||
// hash.js — Password hashing using bcrypt
|
||||
// ============================================================
|
||||
|
||||
const bcrypt = require('bcryptjs');
|
||||
|
||||
function generateSalt() {
|
||||
return bcrypt.genSaltSync(10);
|
||||
}
|
||||
|
||||
function hashPassword(password, salt) {
|
||||
return bcrypt.hashSync(password, salt);
|
||||
}
|
||||
|
||||
function verifyPassword(inputPassword, storedHash) {
|
||||
return bcrypt.compareSync(inputPassword, storedHash);
|
||||
}
|
||||
|
||||
module.exports = { generateSalt, hashPassword, verifyPassword };
|
||||
Reference in new issue
Block a user