Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update README.md#107

Open
kamil-kielczewski wants to merge 4 commits into
aemkei:mainfrom
kamil-kielczewski:patch-4
Open

Update README.md#107
kamil-kielczewski wants to merge 4 commits into
aemkei:mainfrom
kamil-kielczewski:patch-4

Conversation

@kamil-kielczewski

Copy link
Copy Markdown
Contributor

escape/unescape for get all characters without using deprecated methods

escape/unescape for get all characters without using deprecated methods
@hazzik

hazzik commented Sep 1, 2020

Copy link
Copy Markdown
Contributor

Using escape is strictly speaking not a discovery. The italics (and other "deprecated" methods) are used to get a shorter version. Current version is at least 100 characters shorter than the version in the SO answer. And whopping 2100 characters shorter than formula at "step5". (The shortest version would be with atob/btoa, but it does not work everywhere).

@hazzik

hazzik commented Sep 1, 2020

Copy link
Copy Markdown
Contributor

Also, all the current formulas were found using the automatic methods.

@kamil-kielczewski

kamil-kielczewski commented Sep 1, 2020

Copy link
Copy Markdown
Contributor Author

@hazzik ok - but I think such information should be included in documentation (because lack of that I was deluded and loose a lot of time on try to solve this problem with "C" - and finnaly I ask on StackOverflow). It is not trivial (to get that 'critical' letter "C" without using deprecated methods). And in case when deprecated method stops work, this is also some kind of semi-protection (because escape is not strictly deprecated). We can also add information that deprecated method was used because of size-optimalization.

Can you give som link which shows that this technique was discovered earlier? Then we change links to that source. (we can also change text in more proper way - if you have some alternative proposition)

@kamil-kielczewski

kamil-kielczewski commented Sep 1, 2020

Copy link
Copy Markdown
Contributor Author

optimization: @hazzik I see that you like optimizastions some time a go I give proposition #70 (2 years ago) to introduce simple "compression" (actually conversion) - and finnaly I do it myself yesterday - look on this little project - may be it will be interesting for you (it gives ~10x smaller code and this proportion increase when input code size growths). For me in that project it was important to use non-deprecated methods in decompression code (I not introduce this solution there yet) to get more "durable" version

fix text in (un)escaepe section
Comment thread README.md Outdated
Comment thread README.md Outdated
@aemkei

aemkei commented Sep 1, 2020

Copy link
Copy Markdown
Owner

I like the idea of encoding the characters into numbers in a bootstrap to save space.

Have you thought about using octal sequences? This would save some some space per characters:

EG:

eval(eval("'91419154914591629164950961951'".replace(/9/g, "\\")))

The bootstrap code is ~25k but maybe we can save some bytes by replacing the quotes or backspace.

fix typos
@kamil-kielczewski

kamil-kielczewski commented Sep 1, 2020

Copy link
Copy Markdown
Contributor Author

@aemkei Interesting idea - In free time I will check this and compare with base4. However currently I don't understand how abort(1) is coded inside eval('\141\154\145\162\164\50\61\51') :P

Update:
Ok now I get: '\141\154\145\162\164\50\61\51' in chrome console gives "alert(1)" - very clever, may be it is the way to get even better "compression" ratio

Find forum from 2013 witch escape/unescape
@hazzik hazzik mentioned this pull request Sep 2, 2020
@hazzik

hazzik commented Sep 2, 2020

Copy link
Copy Markdown
Contributor

The bootstrap code is ~25k

I managed to reduce it to 5k, see my PR

@kamil-kielczewski

kamil-kielczewski commented Sep 2, 2020

Copy link
Copy Markdown
Contributor Author

@aemkei I analyse and test you proposition details here (base4 is better) and I propose more promising modification which (in details) I analyse in near future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants