« | Main | »

Can you hack in JewelScript?

By Jewe | November 21, 2014

JewelScript looks like a nice language — but it’s all so serious and tidy with the semicolons and stuff. So can you really ‘hack’ in JewelScript?

Yes you can! Here is a code example of Tim William’s Email-Obfuscator. I ported it from JavaScript to JewelScript and reformatted it so that all code is on a single text line. You can run it using the JILRun command-line application.

import stdlib;function string main(const string[] args){string coded="pvOvhSbvx@ivgv.Sxr";string key="cZYL6F9AgSD8ifBHt5XNUyRd1er2CnWlkqT0KzIampuvxV4GJh7Mwo3QjsPbEO";int shift=coded.length;string link;int ltr;for(int i;i<coded.length;i++){if(key.indexOf(coded.charAt(i),0)==-1){ltr=coded.charAt(i);link+=string::ascii(ltr);}else{ltr=(key.indexOf(coded.charAt(i),0)-shift+key.length)%key.length;link+=string::ascii(key.charAt(ltr));}}stdlib::println("<a href='mailto:"+link+"'>email</a>");return link;}

Topics: blog | Comments Off on Can you hack in JewelScript?

Comments are closed.