datasquirel/functions/hashPassword.js
2023-08-12 16:46:00 +01:00

14 lines
340 B
JavaScript

const { createHmac } = require("crypto");
/**
* # Hash password Function
* @param {string} password
* @returns {string}
*/
module.exports = function hashPassword(password) {
const hmac = createHmac("sha512", process.env.ENCRYPTION_PASSWORD);
hmac.update(password);
let hashed = hmac.digest("base64");
return hashed;
};