密码加密的最佳方法是什么

What is the best approach for password encryption

从前端到后端加密在注册过程中从前端收到的密码的最佳做法是什么。例如,是否应该在前端加密发送,然后在后端重新加密?如果您能在 node.js 具体

中回答,我将不胜感激
    const bcrypt = require('bcrypt');
    const SimpleCrypto = require('simple-crypto-js').default;
    const _secretKey = "YOURKEYHERE"; //key for create hash key 
    const simpleCrypto = new SimpleCrypto(_secretKey);
    const saltRounds = 12;
    
    exports.createHashPwd = function (password) {
      return bcrypt.hashSync(password, saltRounds);
    };
    
    //create hashpassword string
    const hashPassword = await passwordService.createHashPwd(plainTextPd);

你可以在这里了解更多https://www.npmjs.com/package/simple-crypto-js