This file contains 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
//using encoder online tools @ http://www.scriptcompress.com/30-encoders-in-1.htm | |
function hex(Δ){return Δ.replace(/./g,function(Δ){return'\\x'+Δ.charCodeAt(0).toString(16)})}; | |
alert(hex('ScripCompress.com')); | |
//lets bracket notation stuff | |
function hex(Δ){return Δ['replace'](/./g,function(Δ){return'\\x'+Δ['charCodeAt'](0)['toString'](16)})}; | |
alert(hex('ScripCompress.com')); |
This file contains 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
var code = " alert( 'ScriptCompress.com' ); "; | |
var command="eval"; //command="\x65val"; | |
function runner( Δ, ǃ ) { \u0065v\u0061l( ǃ )( Δ ) }; | |
runner( code, command ); |
This file contains 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
Δ=~[],Δ={ǃǃǃ:++Δ,ππππ:(!1+"")[Δ],ǃǃπ:++Δ,πǃπǃ:(!1+"")[Δ],ǃπǃ:++Δ,πǃππ:({}+"")[Δ],ππǃπ:(Δ[Δ]+"")[Δ], | |
ǃππ:++Δ,πππǃ:(!0+"")[Δ],πǃǃ:++Δ,πǃπ:++Δ,ππǃǃ:({}+"")[Δ], | |
ππǃ:++Δ,πππ:++Δ,πǃǃǃ:++Δ,πǃǃπ:++Δ}, | |
Δ.πǃ=(Δ.πǃ=Δ+"")[Δ.πǃπ]+(Δ.ǃπ=Δ.πǃ[Δ.ǃǃπ])+(Δ.ππ=(Δ.π+"")[Δ.ǃǃπ])+(!Δ+"")[Δ.ǃππ]+(Δ.ǃǃ=Δ.πǃ[Δ.ππǃ])+(Δ.π=(!0+"")[Δ.ǃǃπ])+(Δ.ǃ=(!0+"")[Δ.ǃπǃ])+Δ.πǃ[Δ.πǃπ]+Δ.ǃǃ+Δ.ǃπ+Δ.π,Δ.ππ=Δ.π+(!0+"")[Δ.ǃππ]+Δ.ǃǃ+Δ.ǃ+Δ.π+Δ.ππ,Δ.π=Δ.ǃǃǃ[Δ.πǃ][Δ.πǃ], | |
Δ.π(Δ.π(Δ.ππ+'"'+Δ.ππππ+Δ.ǃ+"\\"+Δ.ǃǃπ+Δ.πǃπ+Δ.ππǃ+Δ.ππǃǃ+Δ.ǃǃ+"\\"+Δ.ǃǃπ+Δ.πǃπ+Δ.ǃǃπ+Δ.ǃπ+"\\"+Δ.ǃǃπ+Δ.πǃπ+Δ.ππǃ+"\\"+Δ.πǃǃ+Δ.ǃǃǃ+Δ.ππǃǃ+Δ.ǃπ+Δ.ππǃπ+Δ.πππǃ+"\\"+Δ.ǃǃπ+Δ.ǃπǃ+Δ.ǃπǃ+Δ.ǃ+"\\"+Δ.ǃǃπ+Δ.πǃπ+Δ.ππǃ+"\\"+Δ.ǃǃπ+Δ.πǃπ+Δ.ππǃ+Δ.πππǃ+"\\"+Δ.ǃǃπ+Δ.ππǃ+Δ.ǃπǃ+"("+Δ.ππǃǃ+Δ.ǃπ+Δ.ππǃπ+Δ.πππǃ+","+Δ.ππǃǃ+Δ.ǃπ+"\\"+Δ.ǃǃπ+Δ.πǃπ+Δ.πǃπ+"\\"+Δ.ǃǃπ+Δ.πǃπ+Δ.πǃπ+Δ.πǃπǃ+"\\"+Δ.ǃǃπ+Δ.πǃπ+Δ.ππǃ+Δ.ππǃπ+"){"+Δ.πππǃ+"\\"+Δ.ǃǃπ+Δ.ππǃ+Δ.ππǃ+Δ.πǃπǃ+(!1+"")[Δ.ǃπǃ]+"("+Δ.ππǃǃ+Δ.ǃπ+"\\"+Δ.ǃǃπ+Δ.πǃπ+Δ.πǃπ+"\\"+Δ.ǃǃπ+Δ.πǃπ+Δ.πǃπ+Δ.πǃπǃ+"\\"+Δ.ǃǃπ+Δ.πǃπ+Δ.ππǃ+Δ.ππǃπ+")("+Δ.ππǃǃ+Δ.ǃπ+Δ.ππǃπ+Δ.πππǃ+")}\\"+Δ.ǃǃπ+Δ.ππǃ+Δ. |
This file contains 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
//eample of weird and crazy obfuscation on http://www.whak.ca/ (whak-a-script) | |
var W,H,A,K,com;for(W='̷̷̷̷̷̧̛̛̛̛̛͇̟͕̰̗͎͇͕̗̖͇͕͔͎̎̎̎̎̍̍̇̍̍̇͛̎̚̕ͅ҉̷̷͕̎̍̍̎̓͛̎͛̚ͅ\n̷̛͇͕͕̟͔̎ͨ͛ͅͅ\n̷̷̛̥͎̰͇͇̟͉ͣͨͨ̎ͣͨͨ҉̷̵̵̴͇̟͇͕͕̟̣̘̘͔̎ͫ̎ͨ̎̓̎̎ͣ͊͊̋ͣ͊͊҉͇͕͕̟̎ͨ̎̓҉̷͇̟̎̎̓̎͛\n̷̷̛͇̟͉ͣͨͨ҉̷͇̟͇͕͕̟̎ͫ̎ͨ̎̓͛',K='',com=31;127>com;com++)K+=String.fromCharCode(com);K=K.split(''),A='̫̎̉̔̊̇ͅ҉̴̧̖̼̙̩̘̺̝̭͙̓̀̿ͫͬ͊̋́͛̃͗͌ͭͦ̐͆̈́͘͡͝͏̶̵̷̸̡̨̢̛͉̪̤̟̥̰̱͔͕͇̗͎̻̣̞͍̦̬̜͈̳͓̹̲̠̮̯͖͚͂̂ͪ̄ͯ̾̑̽ͨ̌̍ͣ̆ͮ̈̓ͩ͐͑ͤͧ̀̏̅̒͒͋ͥ́̕̚͢͜͟͠͞'.split('');for(var S in A)W=W.split(A[S]).join(K[S]);this['eval'](W); | |
//this was our original JavaScript source code: | |
var code = " alert( 'ScriptCompress.com' ); "; | |
var command="eval"; //command="\x65val"; | |
function runner( Δ, ǃ ) { \u0065v\u0061l( ǃ )( Δ ) }; | |
runner( code, command ); | |
//ALL BELOW SAMPLES ARE ACTUAL WORKING JAVASCRIPT |
This file contains 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
if(window.location.hash) { | |
alert(window.location.hash.replace("#","")); | |
//above we simply get rid of the first occurance of #, without global set, only first match dealt with | |
} else { | |
alert('no hash for you'); | |
} | |
//this is a WHAK.com script :) |
This file contains 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
// Base64 encoing sucks, it makes everything 33% bigger. But, we are going to make it smaller using | |
// tools on http://www.scriptcompress.com/DNA-Packer.htm | |
//demo script using 5.5KB Base64 encoding of 4KB of HTML code | |
pack='PGgyPkZyZWUgVG9vbHMgRm9yIFByb2dyYW1tZXJzOjwvaDI+CjxoND48YSBocmVmPSJodHRwO\ | |
i8vd3d3LnNjcmlwdGNvbXByZXNzLmNvbS9KYXZhU2NyaXB0LVBhY2tlcnMuaHRtIj4yMCBQYWNrZXJz\ | |
IEluIDEgQXBwPC9hPjwvaDQ+CjxoND48YSBocmVmPSJodHRwOi8vd3d3LnNjcmlwdGNvbXByZXNzLmN\ | |
vbS9QSFAtUGFja2VyLmh0bSI+UEhQIFNvdXJjZSBDb2RlIFBhY2tlcnM8L2E+PC9oND4KPGg0PjxhIG\ | |
hyZWY9Imh0dHA6Ly93d3cuc2NyaXB0Y29tcHJlc3MuY29tL1RleHQtVG8tSmF2YVNjcmlwdC5odG0iP\ | |
lRleHQgUGFja2VyPC9hPjwvaDQ+CjxoND48YSBocmVmPSJodHRwOi8vd3d3LnNjcmlwdGNvbXByZXNz\ |
This file contains 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
//BEFORE: below is 394 byte sample that we want to make smaller with one simple technique | |
/* | |
var r={d4:function(){return Math.floor(4*Math.random())+1}, | |
d6:function(){return Math.floor(6*Math.random())+1},d8:function(){return Math.floor(8*Math.random())+1}, | |
d10:function(){return Math.floor(10*Math.random())+1},d12:function(){return Math.floor(12*Math.random())+1}, | |
d20:function(){return Math.floor(20*Math.random())+1}};alert("rolling D4 : "+r.d4()),alert("rolling D20 : "+r.d20()); | |
*/ | |
//AFTER: 340 bytes, over 50 bytes saved |
This file contains 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
//create blob link for downloading data | |
var name = "YourFile.txt", data = "THIS IS JUST A TEST", d = "download", $ = "setAttribute", _ = document, r = new Blob([ data ], { | |
"type": "text/plain;charset=utf8;" | |
}), e = _.createElement("a"); | |
void 0 !== e[d] ? (e[$]("href", window.URL.createObjectURL(r)), e[$](d, name)) : e[$]("href", "http://www.whak.com"), | |
e.innerHTML = "Download", _.body.appendChild(e); |
This file contains 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
//make a javascript source code downloadable by blob | |
var name="script.js",data="alert('THIS IS A TEST');",d="download",$="setAttribute",_=document, | |
r=new Blob([data],{type:"text/plain;charset=utf8;"}),e=_.createElement("a"); | |
void 0!==e[d]?(e[$]("href",window.URL.createObjectURL(r)), | |
e[$](d,name)):e[$]("href","http://www.whak.com"),e.innerHTML="Download",_.body.appendChild(e); |
This file contains 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
// click on generated href link dynamically created and attached to page | |
var Δ="script.js",data="alert('THIS IS A TEST');",d="download",$="setAttribute",_=document, | |
r=new Blob([data],{type:"text/plain;charset=utf8;"}),e=_.createElement("a"); | |
void 0!==e[d]?(e[$]("href",window.URL.createObjectURL(r)),e[$](d,Δ)):e[$]("href","http://www.whak.com"), | |
e.click(),_.body.appendChild(e); | |
//automatic downloader, download pops up right after page load |