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

Alternative coding base9 #8

Open
kamil-kielczewski opened this issue Sep 3, 2020 · 2 comments
Open

Alternative coding base9 #8

kamil-kielczewski opened this issue Sep 3, 2020 · 2 comments

Comments

@kamil-kielczewski
Copy link
Owner

kamil-kielczewski commented Sep 3, 2020

Again we go back do idea from #4 but now the goal is not best compression ratio but shorter decoder - which will be used for small codes - 3 versions to check (last one have best compression ratio)

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

eval(eval("'false141false154false145false162false164false50false61false51'".split("false").join("\\")))

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

So we actually don't want to use shortest available jsf representation for each number - each number will be directly represented by jsf number code. This allow to short decoder (with cost of lower "compression" ratio)

@kamil-kielczewski kamil-kielczewski changed the title Alternative coding 3 Alternative coding base9 Sep 5, 2020
@kamil-kielczewski
Copy link
Owner Author

kamil-kielczewski commented Sep 8, 2020

Function("eval('"+"91419154914591629164950961951".split("9").join("\\")+"')")()

Array["from"]("000141154145162164050061051".matchAll("...")).join("\\").slice(3)

This second one allows to ommit adding \ at the beginning

Below function returns very interesting string:

""+"".matchAll("") 

We get backslash with this RegExp("/")

// slash
console.log(
  (""+Function("return "+[8]["concat"](15)["reduce"](""["slice"]["bind"]((""+"".matchAll("")))))()(""))[0]
)


// backshlash
(""+[]["flat"]["constructor"]("return "+[8]["concat"](15)["reduce"](""["slice"]["bind"]((""+"".matchAll("")))))()((""+[]["flat"]["constructor"]("return "+[8]["concat"](15)["reduce"](""["slice"]["bind"]((""+"".matchAll("")))))()(""))[0]))[1]

@kamil-kielczewski
Copy link
Owner Author

kamil-kielczewski commented Sep 9, 2020

This comment is for shortest possible decoder case

// step 0
Function("eval('"+"91419154914591629164950961951".split("9").join("\\")+"')")()

// step 1
Function("eval"+([]["flat"]+"")[13]+("")["fontcolor"]()[12]+"91419154914591629164950961951".split("9").join("\\")+("")["fontcolor"]()[12]+([0]+false+[]["flat"])[20])()

// step 2
Function("eval"+([]["flat"]+"")[13]+("")["fontcolor"]()[12]+"91419154914591629164950961951".split("9").join("\\")+("")["fontcolor"]()[12]+([0]+false+[]["flat"])[20])()

// step 3
[]["flat"]["constructor"]("eval"+([]["flat"]+"")[13]+("")["fontcolor"]()[12]+"91419154914591629164950961951"["split"]("9")["join"]("\\")+("")["fontcolor"]()[12]+([0]+![]+[]["flat"])[20])()

// step 4
[]["flat"]["constructor"]("eval"+([]["flat"]+[])[[+!+[]]+[!+[]+!+[]+!+[]]]+([]+[])["fontcolor"]()[[+!+[]]+[!+[]+!+[]]]+("91419154914591629164950961951")["split"]([!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[])["join"]("\\")+([]+[])["fontcolor"]()[[+!+[]]+[!+[]+!+[]]]+([+[]]+![]+[]["flat"])[[!+[]+!+[]]+[+[]]])()

Decoder pure jsf size: 6605 char

  1. TOSO: check this:
Function(Function("return "+("")["fontcolor"]()[12]+"91419154914591629164950961951".split("9").join("\\")+("")["fontcolor"]()[12])())()

UPDATE: i check above function here - we have 5783 char (so using eval is longer)

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

No branches or pull requests

1 participant