2019-03-28 23:06:49 JavaScript

【ファイルサイズ爆増注意!】javascriptを難読化するスクリプト

Copy Copied! Full
const replaced = m=>({'0':'_','1':'$','2':'☆','3':'★','4':'→','5':'←','6':'↑','7':'↓','8':'♪','9':'Δ','a':'λ','b':'ω','c':'⊇','d':'∩','e':'∫','f':'∞'}[m]); function convert(source) { source = [...source].map(it=>it.charCodeAt(0)).map(it=>({num: it, face: it.toString(16).replace(/[0-9a-f]/g,replaced)})); let nums = [...new Array(Math.max.apply(null, source.map(it=>it.num))+1).keys()].map(it=>({num: it, face: it.toString(16).replace(/[0-9a-f]/g,replaced)})); let ret = nums.map(it=>{ switch(it.num) { case 0: return '_ = ![]'; case 1: return '$ = !_'; default: return `${it.face} = ${nums[it.num-1].face}+${nums[1].face}`; } }).join(','); return `(0,eval)("${ret},($,eval)('[${source.map(it=>it.face)}].map(String.fromCodePoint)')");` }
【ファイルサイズ爆増注意!】javascriptを難読化するスクリプト
RECOMMEND