Citation link: "Flappy Pig" by the master cracked, code analysis
See this article two days ago, have a kind of IOCCC style. Can not help but do the following analysis, the shortcomings of the hope that there is an expert in the liberal enlighten, first thanked.
Unfortunately, it is automatically generated. But there are a lot of places that are worth learning.
_ = ~[]; // -1; /* uses an empty array and a weakly typed language attribute to, the value of the omitted Type JS hollow array is equal to false and 0 */_ = {___ : ++_, // 0, self-$$$$ : (![] + "") [_], // "F", false's first character/* it's interesting that the, is also false. because an empty array actually exists, So the value that exists is reversed to false. but the value of the existing object conversion is the same as false and does not mean that the value of this object is False. js false and 0 is also equal */__$ : + +_, // 1, self-$_$_ : (![] + "") [_], // "a", false's second character _$_ : ++_, // 2, self-increment one $_$$ : ({} + "") [_], // "B", [object object] the third character $$_$ : (_[_] + "") [_], // "D", the third character of undefined _$$ : ++_, // 3, self-increment one $$$_ : (! "" + "") [_],// "E", true fourth character $__ : ++_, // 4, self-increment one $_$ : + +_, // 5, self-$$__ : ({} + "") [_], // "C", [objecT object] Sixth character $$_ : ++_, // 6, self-increment one $$$ : ++_, // 7, self-increment one $___ : ++_, // 8, self-increment one $__$ : ++_ // 9, self-increment one};_.$_ = (_.$_ = _ + "") The sixth character of [_.$_$] // "C", [object object] + (_._$ = _.$_ [_.__$]) // the second character of "O", [object object] + (_.$$ = (_.$ + "") [_.__$]) // "n", undefined's second character + ((!_) + "") [_ ._$$] // "S", false's fourth character + (_.__ = _.$_[_.$$_]) // "T", [object object], seventh character + (_.$ = (! "" + "") [_.__$]) // "R", true's second character + (_._ = (! "" + "") [_._$_]) // "U", true's third character + The sixth character of;_.$_[_.$_$] // "C", [object object] + _.__ // "T", above assignment + _._$ // "O", above assigned value + _.$; // "R", above assigned value _.$$ = _.$ // "R", above assignment + (! "" + "") [_._$$] // "E", the fourth character of true + _.__ // "T", Above assignment + _._ // "U", above assigned value + _ .$ // "R", above assignment + _.$$; // "n", above assigned value _.$ = (_.___) [_.$_] The value of [_.$_]; // function ()/* _.___ is 0, _.$_ is the "constructor", above, so it is (0) ["Constructor The constructor of the "[" constructor "], 0" number (), the constructor function () of number () */_.$ ( // function ( _.$ ( // Function _.$$ return, top + "\" // ", String start + _.$$$$ // "F", above assigned value + (![] + "") [_._$_] // "L", false's third character + _.$_$_ // "A", above assignment + "\ \" // "\" + _.__$ // "1", above assignment + _.$$_ // "6", above assigned value + _.___ // "0", above assigned value /* "\160", octal "P" */ + "\ \" // "\" + _.__$ // "1", above assigned value + _.$$_ // "6", above assigned value + _.___ // "0", above assigned value /* "\160", octal "P" */ + "\ \" // "\" + _.__$ // "1", Above assignment + _.$$$ // "7", above value + _.__$ // "1", above assigned value /* "\171", octal "y" */ + ". \" // ". \" + _.__$ // "1", above assigned value + _.$_$ // "5", above assigned value + _.__$ // "1", above assignment /* "\151", octal "I" */ + "\ \" // "\" + _.__$ // "1", above assigned value + _.$_$ // "5", above assigned value + _.$ $_ // "6", above assignment /* "\156", octal "n" */ + "\ \" // "\" + _.__$ // "1", above assigned value + _.$_$ // "5", above assigned value + _._ _$ // "1", above assignment /* "\151", octal "I" */ + _.__ // "T", above assignment + "();" // "();", function call ends + "\" " // ", End of String ) () // function call End /* construct character as function */) (); // End of Function call
The code cleverly borrows true, false, [object Object] and octal escape to produce characters, and uses constructor to convert characters into a statement that can be run.
Originally intended to analyze the generation of the site's source code, but recently was too busy. Have a chance later.
This article from the "Temp" blog, reproduced please contact the author!
Code Analysis-Re-analysis of "Flappy Pig" by the master cracked