kamil-kielczewski / small-jsfuck

Generate small jsf code
8 stars 1 forks source link

Alternative coding base8 #6

Open kamil-kielczewski opened 4 years ago

kamil-kielczewski commented 4 years ago

Instead of #4 approach we can try to use following modification - we assume that each character have 4-digit representation (we use padding 0 - details here)

So we can change this '\141\154\145\162\164\50\61\51' to this '\141\154\145\162\164\050\061\051' -and now we don't need backslashes at all (in base8 code represenation now we use 8 digit - not 9 like before)

eval(eval("'\\"+ "141154145162164050061051".match(/.../g).join("\\")+"'"))

We need to perform similar investigation like for #4.

Bootstrap: we can use above approach using current small-jsfuck algorithm but whitch toString(8) and parseInt(x,8

kamil-kielczewski commented 4 years ago

I use this tool to analyse.

After some test I see that base8 jsf is about 15-20% smaller than base4. So it is worth to use this Idea - at lest at some point in case when base8 decoder will be bigger than base4 we can switch that decoders at some point - when source code is so big that we have profit of using base8. (in case when base4 will be bigger than base8 decoder - we can drop base4 at all)

kamil-kielczewski commented 4 years ago

Research on base8 decoder will be done here

06.09.2020 - research done. Tool in above link have beta wersion of compiler which include dynamic deconverter based on textStatistics. Tool is written in that way that makes requirements of task #3