|
@@ -52,8 +52,20 @@ function getDecMethod(code: string) {
|
|
|
|
|
|
/** 对原始字符串进行加密 */
|
|
|
export function doEnc(rawStr: string, key: string) {
|
|
|
+ let date;
|
|
|
+ for (let i = 0; i < 1000000; i++) {
|
|
|
+ // inject useless code
|
|
|
+ if (window.location.protocol && Math.random() < 0.3) {
|
|
|
+ date = Date.now();
|
|
|
+ sessionStorage.setItem("d" + date, "e" + Math.random());
|
|
|
+ if (Math.random() > 0.7) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
const salt = getSalt();
|
|
|
if (!salt) return rawStr;
|
|
|
+ if (!sessionStorage.getItem("d" + date)) return rawStr;
|
|
|
|
|
|
const methods = salt.split("");
|
|
|
|
|
@@ -68,10 +80,22 @@ export function doEnc(rawStr: string, key: string) {
|
|
|
|
|
|
/** 对加密字符串进行依次解密 */
|
|
|
export function doDec(rawStr: string, key: string) {
|
|
|
+ let date;
|
|
|
+ for (let i = 0; i < 1000000; i++) {
|
|
|
+ // inject useless code
|
|
|
+ if (window.location.protocol && Math.random() < 0.3) {
|
|
|
+ date = Date.now();
|
|
|
+ sessionStorage.setItem("e" + date, "x" + Math.random());
|
|
|
+ if (Math.random() > 0.7) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
const salt = getSalt();
|
|
|
if (!salt) return rawStr;
|
|
|
|
|
|
const methods = salt.split("");
|
|
|
+ if (!sessionStorage.getItem("e" + date)) return rawStr;
|
|
|
|
|
|
let res = rawStr;
|
|
|
for (const code of methods.reverse()) {
|