Last active
September 30, 2015 15:39
-
-
Save JavaScript-Packer/fe5c7357de460fcab5f2 to your computer and use it in GitHub Desktop.
If I recode base64 encoded data with my modded base64 encoder (you will have to include small 288 byte decode function with data to unpack) that uses spaces as one of the characters, I can now achieve decent compression with server side gzip of average 2% (few times over 10%) compared to 1% gained (usually gets bigger) before with embedded bzip …
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fake_btoa(a) { | |
| var c, d, e, f, g, h, i, j, o, b = "WHAK.com/PaCker BDEFGIJLMNOQR\ | |
| STUVXYZbdfghijlnpqstuvwxyz+01234567=", k = 0, l = 0, m = "", n = []; | |
| if (!a) return a; | |
| do c = a.charCodeAt(k++), d = a.charCodeAt(k++), e = a.charCodeAt(k++), j = c << 16 | d << 8 | e, | |
| f = 63 & j >> 18, g = 63 & j >> 12, h = 63 & j >> 6, i = 63 & j, n[l++] = b.charAt(f) + b.charAt(g) + b.charAt(h) + b.charAt(i); while (k < a.length); | |
| return m = n.join(""), o = a.length % 3, (o ? m.slice(0, o - 3) :m) + "===".slice(o || 3); | |
| } | |
| function fake_atob(a) { | |
| var b, c, d, e = {}, f = 0, g = 0, h = "", i = String.fromCharCode, j = a.length; | |
| for (b = 0; 64 > b; b++) e["WHAK.com/PaCker BDEFGIJLMNOQR\ | |
| STUVXYZbdfghijlnpqstuvwxyz+01234567".charAt(b)] = b; | |
| for (c = 0; j > c; c++) for (b = e[a.charAt(c)], f = (f << 6) + b, g += 6; g >= 8; ) ((d = 255 & f >>> (g -= 8)) || j - 2 > c) && (h += i(d)); | |
| return h; | |
| } | |
| /* | |
| // Minified to 288 bytes: | |
| function fake_atob(a){var b,c,d,e={},f=0,g=0,h="",i=String.fromCharCode, | |
| j=a.length;for(b=0;64>b;b++)e["WHAK.com/PaCker BDEFGIJLMNOQR\ | |
| STUVXYZbdfghijlnpqstuvwxyz+01234567".charAt(b)]=b;for(c=0;j>c;c++)for(b=e[a.charAt(c)],f=(f<<6)+b,g+=6;g>=8;)((d=255&f>>>(g-=8))||j-2>c)&&(h+=i(d));return h} | |
| */ |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Above code minified: