Skip to content

Instantly share code, notes, and snippets.

@robbi5
Created September 5, 2011 07:42
Show Gist options
  • Save robbi5/1194330 to your computer and use it in GitHub Desktop.
Save robbi5/1194330 to your computer and use it in GitHub Desktop.
Understanding "impossible to understand Javascript: Obfuscated Quine" from http://blog.oimae.com/
_ = $_ = +[], /* 0 */
$ = +!_, /* 1 */
_$ = !_ + '', /* "true" */
_$$ = !$ + '', /* "false" */
__ = ({}) + '', /* "[object Object]" */
_$_ = ($ / _) + '', /* "Infinity" */
__$ = __[$ + $ + $ + $ + $]; /* "c" */
$_$ = [][__$ + __[$] + _$_[$] + __$ + _$$[$] + _$[_]]; /* function concat() { [native Code] } */
/* -> []["c" + ("[object Object]")[1] + ("Infinity")[1] + "c" + ("false")[1] + ("true")[0] ] */
/* -> []["c" + "o" + "n" + "c" + "a" + "t"] */
$__ = ($_$ + '')[$$$$ = (($ + $) + '' + (($ << $) * ($ + $ + $)))] + ($_$ + '')[$$$$ - $] + _$$[$] + _$$[$ + $]; /* "eval" */
/* -> ("function concat() { [native Code] }")[26] + ("function concat() { [native code] }")[25] + ("false")[1] + ("false")[2] */
/* -> "e" + "v" + "a" + "l" */
__$$ = (__$ = $_$ + '')[$_++] + __$[$_++] + __$[$_++] + __$[$_++] + __$[$_++] + __$[$_++] + __$[$_++] + __$[$_++]; /* "function" */
/* -> ("function concat() { [native Code] }")[0++] + ("function concat() { [native Code] }")[1++] ... */
/* -> "f" + "u" + "n" + "c" + "t" + "i" + "o" + "n" */
$_$()[_][$__]('' + _$$[_] + __[$] + _$[$] + '($$=_,$$$=[];$$<($<<($+$+$));$$++)$$$[$$]=($<<$$)'); /* [1, 2, 4, 8, 16, 32, 64, 128] */
/* -> [DOMWindow][0]["eval"]('' + 'f' + 'o' + 'r' + '($$=0, $$$=[]; $$<(1<<(1+1+1)); $$++) $$$[$$] = (0<<$$) ') */ /* (defining a for-loop) */
_$_$ = $_$()[_][$__]('' + _$$[_] + __[$] + _$[$] + '($$ ' + _$_[($ << ($ + $)) + $] + _$_[$] + ' $_$()[_])' + _$_[($ << ($ + $)) + $] + _$$[_] + '($$[_]==_$$[$+$+$]&&$$[$]==$__[_]&&$$[$+$]==_$$[$+$+$])$$'); /* "sessionStorage" */
/* -> [DOMWindow][0]["eval"]('' + 'f' + 'o' + 'r' + '($$ ' + ("Infinity")[5] + ("Infinity")[1] + ' concat()[0])' + ("Infinity")[5] + ("false")[0] + ... ) */
/* -> eval('for ($$ in DOMWindow) if ($$[_] == _$$[$+$+$] && $$[$] == $__[_] && $$[$+$] == _$$[$+$+$]) $$') */
/* -> eval('for ($$ in DOMWindow) if ($$[0] == ("false")[3] && $$[1] == ("eval")[0] && $$[2] == ("false")[3]) $$') */
/* -> eval('for ($$ in DOMWindow) if ($$[0] == "s" && $$[1] == "e" && $$[2] == "s") $$') */
$__$ = __$$ + ' (){' + _$[$] + _$[$ + $ + $] + _$[_] + __$$[$] + _$[$] + _$_[$] + '('; /* "function () { return(" */
/* -> "function" + ' (){' + ("true")[1] + ("true")[3] + ("true")[0] + ("function")[1] + ("true")[1] + ("Infinity")[1] + '(' */
/* -> "function" + ' (){' + "r" + "e" + "t" + "u" + "r" + "n" + '(' */
_$__ = $_$()[_][$__]('' + _$$[_] + __[$] + _$[$] + '($$ ' + _$_[($ << ($ + $)) + $] + _$_[$] + ' $_$()[_])' + _$_[($ << ($ + $)) + $] + _$$[_] + '($$[_]==_$_$[($<<($+$))*($+$+$)]&&$$[$]==_$[$+$+$]&&$$[$+$]==_$[_]&&$$[$<<($+$)]==__[$])$$'); /* "getComputedStyle" */
/* -> [DOMWindow][0]["eval"]('' + 'f' + 'o' + 'r' + '($$ ' + ("Infinity")[5] + ("Infinity")[1] + ' concat()[0])' + ("Infinity")[5] + ("false")[0] + ... ) */
/* -> eval('for ($$ in DOMWindow) if ($$[_] == _$_$[($<<($+$))*($+$+$)] && $$[$] == _$[$+$+$] && $$[$+$] == _$[_] && $$[$<<($+$)] == __[$]) $$') */
/* -> eval('for ($$ in DOMWindow) if ($$[0] == ("sessionStorage")[12] && $$[1] == ("true")[3] && $$[2] == ("true")[0] && $$[4] == ("[object Object]")[1]) $$')*/
/* -> eval('for ($$ in DOMWindow) if ($$[0] == "g" && $$[1] == "e" && $$[2] == "t" && $$[4] == "o") $$') */
_$$$ = $_$()[_][$__]('' + _$$[_] + __[$] + _$[$] + '($$ ' + _$_[($ << ($ + $)) + $] + _$_[$] + ' $_$()[_])' + _$_[($ << ($ + $)) + $] + _$$[_] + '($$[_]==__[$]&&$$[$]==_$_[$]&&$$[$+$]==__[$+$+$+$+$])$$'); /* "onchange" */
/* -> [DOMWindow][0]["eval"]('' + 'f' + 'o' + 'r' + '($$ ' + ("Infinity")[5] + ("Infinity")[1] + ' concat()[0])' + ("Infinity")[5] + ("false")[0] + ... ) */
/* -> eval('for ($$ in DOMWindow) if ($$[_] == __[$] && $$[$] == _$_[$] && $$[$+$] == __[$+$+$+$+$]) $$') */
/* -> eval('for ($$ in DOMWindow) if ($$[0] == ("[object Object]")[1] && $$[1] == ("Infinity")[1] && $$[2] == ("[object Object]")[5]) $$') */
/* -> eval('for ($$ in DOMWindow) if ($$[0] == "o" && $$[1] == "n" && $$[2] == "c") $$')*/
__$_ = $_$()[_][$__](_$_$[($ << ($ + $ + $)) - $] + _$[_] + _$[$] + _$_[$ + $ + $] + _$_[$] + _$_$[($ << ($ + $)) * ($ + $ + $)] + '.' + _$$[_] + _$[$] + __[$] + _$__[($ + $ + $ + $ + $)] + _$__[$ + $ + $] + _$$$[$ + $ + $] + _$$[$] + _$[$] + _$__[$ + $ + $] + __[$] + _$__[($ + $ + $ + $ + $) * ($ + $)] + _$[$ + $ + $]);; /* function fromCharCode() { [native code] } */
/* -> [DOMWindow][0]["eval"](("sessionStorage")[7] + ("true")[0] + ("true")[1] + ("Infinity")[3] + ("Infinity")[1] + ("sessionStorage")[12] + "." + ("false")[0] + ("true")[1] + ("[object Object]")[1] + ("getComputedStyle")[5] + ("getComputedStyle")[3] + ("onchange")[3] + ("false")[1] + ("true")[1] + ("getComputedStyle")[3] + ("[object Object]")[1] + ("getComputedStyle")[10] + ("true")[3])) */
/* -> eval("S" + "t" + "r" + "i" + "n" + "g" + "." + "f" + "r" + "o" + "m" + "C" + "h" + "a" + "r" + "C" + "o" + "d" + "e") */
$_$()[_][$__]('$_$_=' + __$$ + '($$,$_$_$,$_$_$_$_){' + _$[$] + _$[$ + $ + $] + _$[_] + __$$[$] + _$[$] + _$_[$] + ' $$.' + _$[$] + _$[$ + $ + $] + __$_($$$[($ + $ + $) * ($ + $)] + $$$[$ + $ + $ + $ + $] + $$$[($ + $ + $ + $)]) + _$$[$ + $] + _$$[$] + _$$$[$ + $] + _$[$ + $ + $] + '($_$_$,$_$_$_$_)' + '}'); /* function ($$,$_$_$,$_$_$_$_){return $$.replace($_$_$,$_$_$_$_)} */
/* -> [DOMWindow][0]["eval"]('$_$_=' + "function" + "($$, $_$_$, $_$_$_$_){" + ("true")[1] + ("true")[3] + ("true")[0] + ("function")[1] + ("true")[1] + ("Infinity")[1] + " $$." + ("true")[1] + ("true")[3] + String.fromCharCode($$$[6] + $$$[5] + $$$[4]) + ("false")[2] + ("false")[1] + ("onchange")[2] + ("true")[3] + '($_$_$,$_$_$_$_)' + '}') */
/* -> eval('$_$_ = ' + "function" + '($$, $_$_$, $_$_$_$_){' + "r" + "e" + "t" + "u" + "r" + "n" + ' $$.' + "r" + "e" + String.fromCharCode(112) + "l" + "a" + "c" + "e" + '($_$_$,$_$_$_$_)' + '}')*/
/* -> eval('$_$_ = ' + "function" + '($$, $_$_$, $_$_$_$_){' + "r" + "e" + "t" + "u" + "r" + "n" + ' $$.' + "r" + "e" + "p" + "l" + "a" + "c" + "e" + '($_$_$,$_$_$_$_)' + '}')*/
_$$_ = __$_($$$[$ + $ + $ + $ + $] + $ + $); /* '"' */
/* -> String.fromCharCode($$$[5] + 1 + 1) */
/* -> String.fromCharCode(32 + 1 + 1) */
$_$$ = __$_(($ << ($ + $ + $ + $)) + (($ << ($ + $)) + $ + $ + $) << ($ + $)) + _$$_;; /* '\"' */
/* -> String.fromCharCode((1 << 4) + ((1 << 2) + 3) << 2) + '"' */
/* -> String.fromCharCode(92) + '"' */
___ = __$_((($ + $ + $) + (($ + $) * ($ + $ + $ + $ + $))) * ($ + $ + $)); /* "'" */
/* -> String.fromCharCode((3 + (2 * 5)) * 3) */
/* -> String.fromCharCode(39) */
$_$()[_][$__]("($$_=" + $__$ + "$_$_('_=$_=+[],$=+!_,_$=!_+______,_$$=!$+______,__=({})+______,_$_=($/_)+______,__$=__[$+$+$+$+$];$_$=[][__$+__[$]+_$_[$]+__$+_$$[$]+_$[_]];$__=($_$+______)[$$$$=(($+$)+______+(($<<$)*($+$+$)))]+($_$+______)[$$$$-$]+_$$[$]+_$$[$+$];__$$=(__$=$_$+______)[$_++]+__$[$_++]+__$[$_++]+__$[$_++]+__$[$_++]+__$[$_++]+__$[$_++]+__$[$_++];$_$()[_][$__](______+_$$[_]+__[$]+_$[$]+___($$=_,$$$=[];$$<($<<($+$+$));$$++)$$$[$$]=($<<$$)___);_$_$=$_$()[_][$__](______+_$$[_]+__[$]+_$[$]+___($$ ___+_$_[($<<($+$))+$]+_$_[$]+___ $_$()[_])___+_$_[($<<($+$))+$]+_$$[_]+___($$[_]==_$$[$+$+$]&&$$[$]==$__[_]&&$$[$+$]==_$$[$+$+$])$$___);$__$=__$$+___ (){___+_$[$]+_$[$+$+$]+_$[_]+__$$[$]+_$[$]+_$_[$]+___(___;_$__=$_$()[_][$__](______+_$$[_]+__[$]+_$[$]+___($$ ___+_$_[($<<($+$))+$]+_$_[$]+___ $_$()[_])___+_$_[($<<($+$))+$]+_$$[_]+___($$[_]==_$_$[($<<($+$))*($+$+$)]&&$$[$]==_$[$+$+$]&&$$[$+$]==_$[_]&&$$[$<<($+$)]==__[$])$$___);_$$$=$_$()[_][$__](______+_$$[_]+__[$]+_$[$]+___($$ ___+_$_[($<<($+$))+$]+_$_[$]+___ $_$()[_])___+_$_[($<<($+$))+$]+_$$[_]+___($$[_]==__[$]&&$$[$]==_$_[$]&&$$[$+$]==__[$+$+$+$+$])$$___);__$_=$_$()[_][$__](_$_$[($<<($+$+$))-$]+_$[_]+_$[$]+_$_[$+$+$]+_$_[$]+_$_$[($<<($+$))*($+$+$)]+___.___+_$$[_]+_$[$]+__[$]+_$__[($+$+$+$+$)]+_$__[$+$+$]+_$$$[$+$+$]+_$$[$]+_$[$]+_$__[$+$+$]+__[$]+_$__[($+$+$+$+$)*($+$)]+_$[$+$+$]);;$_$()[_][$__](___$_$_=___+__$$+___($$,$_$_$,$_$_$_$_){___+_$[$]+_$[$+$+$]+_$[_]+__$$[$]+_$[$]+_$_[$]+___ $$.___+_$[$]+_$[$+$+$]+__$_($$$[($+$+$)*($+$)]+$$$[$+$+$+$+$]+$$$[($+$+$+$)])+_$$[$+$]+_$$[$]+_$$$[$+$]+_$[$+$+$]+___($_$_$,$_$_$_$_)___+___}___);_$$_=__$_($$$[$+$+$+$+$]+$+$);$_$$=__$_(($<<($+$+$+$))+(($<<($+$))+$+$+$)<<($+$))+_$$_;',$_$()[_][$__](__$_(''+($<<($+$+$))+($+$),''+$+_+$,''+$+_+($+$+$),''+($+$+$+$+$+$)+($+$+$)*($+$+$),''+$+($+$)+_,''+$+$+($+$))+'('+__$_((($+$+$)+(($+$)*($+$+$+$+$)))*($+$+$))+'___'+__$_((($+$+$)+(($+$)*($+$+$+$+$)))*($+$+$))+','+__$_(''+($+$+$)+(($+$+$)*($+$+$)),''+$+_+($+$+$),''+$+_+($+$+$+$+$),''+($+$+$)+(($+$+$)*($+$+$)))+')'),___)+';___=__$_((($+$+$)+(($+$)*($+$+$+$+$)))*($+$+$));$_$()[_][$__](\"($$_='+$_$_($_$_(($$_+''),_$$_,$_$$),$__$,_$$_+'+$__$+'+_$$_)+')()'+_$$_+')')})()")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment