<commit_before>const crypto = require('crypto');

function sha1(str) {
  var shasum = crypto.createHash("sha1");
  shasum.update(str);
  str = shasum.digest("hex");
  return str;
}

const wechat = {
  wxCheck: () => {
    const ua = window.navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == 'micromessenger') {
      return true;
    } else {
      return false;
    }
  },
  wxsign: (req) => {
    const echostr = req.query.echostr;
    const signature = req.query.signature;
    const timestamp = req.query.timestamp;
    const nonce = req.query.nonce;

    const token = 'n<PASSWORD>';

    let tmpArr = [token, timestamp, nonce];
    tmpArr.sort();

    let sortStr = tmpArr.join('');

    let sha1Str = sha1(sortStr);

    if (signature === sha1Str) {
      res.end(echostr);
    } else {
      res.end('false');
    }
  }
}<commit_msg>暴露wechat模块<commit_after>const crypto = require('crypto');

function sha1(str) {
  var shasum = crypto.createHash("sha1");
  shasum.update(str);
  str = shasum.digest("hex");
  return str;
}

const wechat = {
  wxCheck: () => {
    const ua = window.navigator.userAgent.toLowerCase();
    if (ua.match(/MicroMessenger/i) == 'micromessenger') {
      return true;
    } else {
      return false;
    }
  },
  wxsign: (req) => {
    const echostr = req.query.echostr;
    const signature = req.query.signature;
    const timestamp = req.query.timestamp;
    const nonce = req.query.nonce;

    const token = 'n<PASSWORD>';

    let tmpArr = [token, timestamp, nonce];
    tmpArr.sort();

    let sortStr = tmpArr.join('');

    let sha1Str = sha1(sortStr);

    if (signature === sha1Str) {
      res.end(echostr);
    } else {
      res.end('false');
    }
  }
}

module.exports = wechat;
{'fraction_non_alphanumeric': 0.15705311250713877, 'fraction_numerical': 0.0057110222729868645, 'mean_word_length': 2.8086956521739133, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3357453', 'n_tokens_mistral': 635, 'n_tokens_neox': 621, 'n_words': 126}