数据HmacSHA256方式 加密

import cryptoJS from 'crypto-js';

方法:

getMd5Base64(input: string, key: string | cryptoJS.WordArray): string {

    const test = cryptoJS.HmacSHA256(input, key);

    return test.toString(cryptoJS.enc.Base64);

  }


使用:

console.warn('====== test:' + this.getMd5Base64('sunny=123456', 'sunny'));

参考:https://www.npmjs.com/package/crypto-js

你可能感兴趣的:(数据HmacSHA256方式 加密)