Establish a connection


const crypto = require('crypto')
const { CRYPTO_SECRET_KEY } = require('.. /conf/secretKeys')

/** * MD5 encryption *@param {string} The content clear * /
function _md5(content) {
    const md5 = crypto.createHash('md5')
    return md5.update(content).digest('hex')}/** * Encryption method *@param {string} The content clear * /
function doCrypto(content) {
    const str = `password=${content}&key=${CRYPTO_SECRET_KEY}`
    return _md5(str)
}

module.exports = doCrypto
Copy the code

use

const doCrypto = require(".. /utils/cryp");
await createUser({userName,password:doCrypto(password), gender})
Copy the code