in reply to Lost in a sea of obfuscation...


All the advice thus far given is good, however just to add my .04wassits. Before you look at the how, look at the what. Code obfiscation can be easily catagorised, there are various simple techniques. Judicious use of pack, (as has already been mentioned) using alternative substitution operators, using the ^? variables ;-) What is hard is comming up with the idea.. the what... If you look at other peoples japhs first you will (no matter how hard you try) reproduce what they have done. I would first of all sit down with a cup of java and try and work out what your japh is all about. To illustrate, a collegue of mine frankus wrote a cool japh a while ago based upon the rot algorithm. He stored a string and rotted it to produce the kick. Now the algorithm was obfiscated and he stuck some other nasties in there but the idea was simple. Get your idea first, then look at other japhs to see how to implement it in a -nasty- way.

enjoy I look forward to seeing the result. --

Zigster

Replies are listed 'Best First'.
Obfuscated? Moi?
by frankus (Priest) on Dec 05, 2000 at 17:19 UTC

    I love obfuscation. These obfuscations aren't Perl, I've yet to do Perl obfuscation. Obfuscation comes into it's own using, what other languages calumny as "side-effects" and Perl folk know as 'features'.

    I made a confusing method to produce a Just Another ... for each language. I found the suitability of each language to the job was telling and I tried to have fun with the language's idiom along the way.

    The method is pretty simple:

    • Use a=a^b, b=a^b, a=a^b to juxtapose two variables; I perform a=a^b, b=a^b to generate an XOR'd value.
    • Use a rot5 * to scramble the key to produce the string
    • By XORing each element of the two above you get the phrase. (I chose job titles to reflect my view of the attitude prevailent in the practicioners of each language.)

    When I wrote these, a Java / Perl war was ongoing at work. Not wanting to pick sides (why reduce the chance of a good scrap? :). I used Mutt's mailhooks, to "tune my subtle song". For posterity here are my sig lines (Please don't -- me for referring to other languages, I found the conciseness rang out from these. Yeah I know the Java is a tad long winded but.....)

    # Frank Booth, AHEM DIGITAL (www.ahem.com) tel:(XXX) XXXX XXXX $_='Ozxy%fstymjw%';s:.:chr((ord$&)-5):geo;split//;print$_,map{ $_[$_]^chr((26,16,1,24,0,9,15,12,31,13,23,92,42)[$_])}(0..$#_) /*Frank Booth, AHEM DIGITAL (www.ahem.com) tel: +XX (XXX) XXXX XXXX */ main(){char l[0x1b]={"Ozxy%fstymjw%"};int i=0,I[13]={9,85,3,6,79,6,28, 14,25,5,0,0,14};for(;13-i;l[13+i]=(l[i]-=5)^I[i++]);printf("%s\n",l);} //Frank Booth, AHEM DIGITAL (www.ahem.com) tel: +XX (XXX) XXXX XXXX import java.*;public class S{String a=new String(s("Ozxy%fstymjw%O" ));int[] b={43,3,18,84,68,4,24,10,24,7,21,23,82,100}; public static void main(String[]S){S s=new S();System.out.print(s);}public static String s(String b){StringBuffer w=new StringBuffer(b);for(int i=0;i <0xe; w.setCharAt(i,(char)(w.charAt(i++)-5)));return w.toString();} public String s(){StringBuffer w=new StringBuffer(a);for(int i=0;i< w.length();w.setCharAt(i,(char)(b[i]^(int)w.charAt(i++))));return w .toString();}public String toString(){return a+s()+"\n";}}/* :-) */ <!-- Frank Booth, AHEM DIGITAL (www.ahem.com) tel:(XXX) XXXX XXXX> <html><body bgcolor=#666666 text=#CC9900>&#074;u&#115;&#116;&nbsp; &#097;&#110;&#111;&#116;&#104;&#101;&#114;&#153;&nbsp;<b>&#072;<!- ->&#084;&#077;&#076;&nbsp;</b>w&#114;&#105;te&#114; </body></html>

    (The company name has been changed to protect the innocent, namely me ;0).

    * Okay it's not a true rot routine, but I think this is:    perl -pe's/([a-m])|[n-z]/chr(($1?13:-13)+ord$&)/ogie'

    --
    
    Brother Frankus.
      /([a-m])|[n-z]/chr(($1?13:-13)+ord$&)/ogie

      I know this handles capitals, but isn't it a slight overcomplication of what is really: tr/a-z/n-za-m/

      Or is that part of the obfuscation? Sorry if I've missed the point.

      --
      Brother Marvell