短评 · ·

X 归档 2020-09-02

1 条动态 · 图 1 · 视频 0
@aemkei04:59原推文
Here is a nice little hack to hide code inside a #BigInt. The idea is use octal escape sequences and replace the backslash \ with the digit 9.

// the encoded `alert(1)`
x = 91419154914591629164950961951n;

// the decoder
[`'${x}'`.replace(/9/g, "\\")].map(eval).map(eval)
这里有一个很妙的小技巧,可以把代码藏进 #BigInt 里。思路是使用八进制转义序列,并把反斜杠 \ 替换成数字 9。

// 编码后的 `alert(1)`
x = 91419154914591629164950961951n;

// 解码器
[`'${x}'`.replace(/9/g, "\\")].map(eval).map(eval)
@aemkei 的配图 1/1