{"size": 474, "ext": "js", "max_stars_repo_path": "src/util/cryp.js", "max_stars_repo_name": "xiaofujun/weibo-koa2", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/util/cryp.js", "max_issues_repo_name": "xiaofujun/weibo-koa2", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/util/cryp.js", "max_forks_repo_name": "xiaofujun/weibo-koa2", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 18.96, "max_line_length": 69, "alphanum_fraction": 0.6687763713}
/**
 * @description 密码加密
 * @author 小付君
 */

const crypto = require('crypto');
const { PASSWORD_SECRET } = require('../constant/security');

/**
 * 使用 MD5 加密
 * @param {string} content 要加密的字符串 
 * @returns 
 */
function _md5(content) {
  const md5 = crypto.createHash('md5').update(content).digest('hex');
  return md5; 
}

function genPassword(content) {
  content = `password=${content}&secret=${PASSWORD_SECRET}`;
  return _md5(content);
}

module.exports = genPassword;
