在做登录的时候对密码会进行简单的加密。简单采用MD5和base64加密,或者采用组合加密,盐值加密等,
npm install --save js-base64
npm install --save js-md5
import md5 from "js-md5"
Vue.prototype.$md5 = md5
Vue.prototype.$base64 = require("js-base64").Base64
base64
this.$base64.encode('dankogai'); // ZGFua29nYWk=
this.$base64.encode('小飼弾'); // 5bCP6aO85by+
this.$base64.encodeURI('小飼弾'); // 5bCP6aO85by-
this.$base64.decode('ZGFua29nYWk='); // dankogai
this.$base64.decode('5bCP6aO85by+'); // 小飼弾
// note .decodeURI() is unnecessary since it accepts both flavors
this.$base64.decode('5bCP6aO85by-'); // 小飼弾
md5
this.$md5(''); // d41d8cd98f00b204e9800998ecf8427e
this.$md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6
this.$md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0
// It also supports UTF-8 encoding
this.$md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07
// It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
this.$md5([]); // d41d8cd98f00b204e9800998ecf8427e
this.$md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e
// Different output
this.$md5(''); // d41d8cd98f00b204e9800998ecf8427e
this.$md5.hex(''); // d41d8cd98f00b204e9800998ecf8427e
this.$md5.array(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
this.$md5.digest(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
this.$md5.arrayBuffer(''); // ArrayBuffer
this.$md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.