|
@@ -0,0 +1,99 @@
|
|
|
+/*
|
|
|
+ ** 登录密码加密
|
|
|
+ http://face3d.4dage.com:7005/4dzfb-2.0/shop/src/master/platform-admin/src/main/webapp/login.html
|
|
|
+ */
|
|
|
+function randomWord(randomFlag, min, max?) {
|
|
|
+ let str = '';
|
|
|
+ let range = min;
|
|
|
+ const arr = [
|
|
|
+ '0',
|
|
|
+ '1',
|
|
|
+ '2',
|
|
|
+ '3',
|
|
|
+ '4',
|
|
|
+ '5',
|
|
|
+ '6',
|
|
|
+ '7',
|
|
|
+ '8',
|
|
|
+ '9',
|
|
|
+ 'a',
|
|
|
+ 'b',
|
|
|
+ 'c',
|
|
|
+ 'd',
|
|
|
+ 'e',
|
|
|
+ 'f',
|
|
|
+ 'g',
|
|
|
+ 'h',
|
|
|
+ 'i',
|
|
|
+ 'j',
|
|
|
+ 'k',
|
|
|
+ 'l',
|
|
|
+ 'm',
|
|
|
+ 'n',
|
|
|
+ 'o',
|
|
|
+ 'p',
|
|
|
+ 'q',
|
|
|
+ 'r',
|
|
|
+ 's',
|
|
|
+ 't',
|
|
|
+ 'u',
|
|
|
+ 'v',
|
|
|
+ 'w',
|
|
|
+ 'x',
|
|
|
+ 'y',
|
|
|
+ 'z',
|
|
|
+ 'A',
|
|
|
+ 'B',
|
|
|
+ 'C',
|
|
|
+ 'D',
|
|
|
+ 'E',
|
|
|
+ 'F',
|
|
|
+ 'G',
|
|
|
+ 'H',
|
|
|
+ 'I',
|
|
|
+ 'J',
|
|
|
+ 'K',
|
|
|
+ 'L',
|
|
|
+ 'M',
|
|
|
+ 'N',
|
|
|
+ 'O',
|
|
|
+ 'P',
|
|
|
+ 'Q',
|
|
|
+ 'R',
|
|
|
+ 'S',
|
|
|
+ 'T',
|
|
|
+ 'U',
|
|
|
+ 'V',
|
|
|
+ 'W',
|
|
|
+ 'X',
|
|
|
+ 'Y',
|
|
|
+ 'Z',
|
|
|
+ ];
|
|
|
+ // 随机产生
|
|
|
+ if (randomFlag) {
|
|
|
+ range = Math.round(Math.random() * (max - min)) + min;
|
|
|
+ }
|
|
|
+ for (let i = 0; i < range; i++) {
|
|
|
+ const pos = Math.round(Math.random() * (arr.length - 1));
|
|
|
+ str += arr[pos];
|
|
|
+ }
|
|
|
+ return str;
|
|
|
+}
|
|
|
+
|
|
|
+export function encodeStr(str, strv = ''): string {
|
|
|
+ const NUM = 2;
|
|
|
+ const front = randomWord(false, 8);
|
|
|
+ const middle = randomWord(false, 8);
|
|
|
+ const end = randomWord(false, 8);
|
|
|
+
|
|
|
+ const str1 = str.substring(0, NUM);
|
|
|
+ const str2 = str.substring(NUM);
|
|
|
+
|
|
|
+ if (strv) {
|
|
|
+ const strv1 = strv.substring(0, NUM);
|
|
|
+ const strv2 = strv.substring(NUM);
|
|
|
+ return [front + str2 + middle + str1 + end, front + strv2 + middle + strv1 + end];
|
|
|
+ }
|
|
|
+
|
|
|
+ return front + str2 + middle + str1 + end;
|
|
|
+}
|