Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #107

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

kamil-kielczewski
Copy link
Contributor

escape/unescape for get all characters without using deprecated methods

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

hazzik commented Sep 1, 2020

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
Copy link
Contributor

hazzik commented Sep 1, 2020

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

@kamil-kielczewski
Copy link
Contributor Author

kamil-kielczewski commented Sep 1, 2020

@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
Copy link
Contributor Author

kamil-kielczewski commented Sep 1, 2020

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
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@aemkei
Copy link
Owner

aemkei commented Sep 1, 2020

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
Copy link
Contributor Author

kamil-kielczewski commented Sep 1, 2020

@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
Copy link
Contributor

hazzik commented Sep 2, 2020

The bootstrap code is ~25k

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

@kamil-kielczewski
Copy link
Contributor Author

kamil-kielczewski commented Sep 2, 2020

@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