vue中MD5+base64加密

安装

npm install --save js-base64

npm install --save js-md5

  

全局配置在main.js中配置

import md5 from 'js-md5';
import {Base64} from 'js-base64';

 Vue.prototype.md5 = md5;
 Vue.prototype.Base64 = Base64;

使用

this.Base64.encode('要加密的字符、参数'); 
this.Base64.encodeURI(要加密的字符、参数'');

this.Base64.decode('要解密的字符参数');  
this.Base64.decodeURI('要解密的字符参数');  

  

输出字符
this.md5(''); 
this.md5.hex(''); 


this.md5([]);
this.md5(new Uint8Array([]));

输出数组模式
this.md5.array(''); 
this.md5.digest('');

驼峰
this.md5.arrayBuffer('');
this.md5.buffer('');