z.js

z.js — turns content (in)visible*
Type




WTF?


Get z.js (906B minified & gzipped) / @GitHub
Licensed under the MIT License <http://mit-license.org/>
©2013 Mntn® c/o Benjamin Lips <http://mn.tn/>
*CC-licensed icon by Marwa Boukarim



Share↓
Buffer
Twitter
G+
Facebook
Delicious
Tumblr
LinkedIn
SU


WTF?



z.js 'kicks' content into binary code, replacing 0 with ZWNJ and 1 with ZWJ. That's all the magic.

— Applicable in UTF-8 environments;
   use in posts, tweets, e-mails, et al.
Support: all modern browsers including IE8+
— Hide complete websites (FTW!11)
Blog-like demo (Protecting content)



↓z.min.js ↓z.js ↓z.php ↓z-tools.js




/*


CHANGELOG
0.2 (July 2013)
* dropped 'ASCII-mode' (tabs (\t) and spaces (\x20) instead of Unicode's ZW(N)Js)
* added 'Parts-mode'; 2nd char in MASK param
* header changed; old: <!---->, new: \x00\x00\x00\x00\xff\xff\xff\xff
...


z.js(DAT [, PWD=false, MSK/RAW=false])

DAT -- content to hide/restore*
       (*z.js only parses \u200c and \u200d)
PWD -- Password (RC4)
MSK -- MASK; default (TRUE): ▉
       (z'ed content gets stored between 1st and
       2nd char in output to avoid Copy&Paste issues;
       optional 2nd char: Parts-mode (see Example 2.1))
RAW -- if TRUE, returns raw data instead of
       FALSE if encrypted


*/




0.   //foo,foo,bar
     console.log(tmp='foo'+z.js('bar'),tmp,z.js(tmp));


1.   //Basic example; results in zero-width (168=(8*8)+(11*8)+16)
     var tmp='Something'+z.js('hello world')+' inside';
     console.log(tmp,tmp.length); → 
     console.log(z.js(tmp)); → 


2.   //Masking; tags excluded
     console.log(z.js('hello <em>world</em>',false,'*')) → 


2.1  //'Parts'-mode (2nd MSK-char); keeps wrapped content
     var tmp=z.js('hides only *this* and *that*.',false,'**');
     console.log(tmp) → 
     console.log(z.js(tmp)) → 
     console.log(z.js('Re*pla*ce aster*iks-wrapped* with DOTS',false,'.*'));
     → 
     console.log(z.js('@hello wo@rld@',false,'@@')); →  (?)


3.  //Encrypt
    console.log(z.js(z.js('hello world','yay'),'nay')); → 
    console.log(z.js(z.js('hello world','yay'),'yay')) → 
    console.log(z.js(z.js('hello world','yay'),'nay',true)) → 


4.  //"z'ed"?
    console.log(/\u200c/.test('foo')); → 
    console.log(/\u200c/.test(z.js('foo')); → 





← t.js / Mntn®/dev/z.js