Last active
October 6, 2021 23:25
-
-
Save TimonPeng/ca8b87007f28c592511c54e019fde24d to your computer and use it in GitHub Desktop.
themekaverse.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function btoa(str) { | |
return Buffer.from(str).toString('base64'); | |
} | |
function atob(b64Encoded) { | |
return Buffer.from(b64Encoded, 'base64').toString(); | |
} | |
function decode(rawData) { | |
let t = rawData, | |
n = []; | |
for (let d = 0; d < t.length; d++) { | |
let e = ''; | |
for (let n = 0; n < t[d].length; n++) | |
e += String.fromCharCode(t[d][n] / 5424); | |
n.push(e); | |
} | |
let a = ''; | |
for (let d = 0; d < n.length; d++) a += n[d]; | |
let r = a.substr(1, a.length - 2), | |
i = ''; | |
for (let d = 0; d < r.length; d += 2) | |
d + 1 >= r.length ? (i += r[d]) : (i += r[d + 1] + r[d]); | |
let s = i.split('').reverse().join(''), | |
o = decodeURIComponent(escape(atob(s))); | |
return JSON.parse(o); | |
} | |
function encode(data) { | |
let t = JSON.stringify(data), | |
n = btoa(unescape(encodeURIComponent(t))), | |
a = n.split('').reverse().join(''), | |
r = a.slice(-1); | |
for (let l = 0; l < a.length; l += 2) r += a[l + 1] + a[l]; | |
r += a.substr(0, 1); | |
let i = parseInt((r.length / 8).toString()), | |
s = r.length % i, | |
o = []; | |
for (let l = 0; l < i + 1; l++) { | |
let e = 8; | |
8 * l + 8 > r.length && (e = s), o.push(r.substr(8 * l, e)); | |
} | |
let d = []; | |
for (let l = 0; l < o.length; l++) { | |
let e = []; | |
for (let t = 0; t < o[l].length; t++) e.push(5424 * o[l].charCodeAt(t)); | |
d.push(e); | |
} | |
return d; | |
} |
Author
TimonPeng
commented
Oct 6, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment