Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?B?Sm9zaHVhIENyYW5tZXIg8J+Qpw==?= Newsgroups: comp.lang.java.programmer Subject: Re: java code Date: Sat, 22 Feb 2014 01:10:03 -0600 Organization: A noiseless patient Spider Lines: 50 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 22 Feb 2014 07:10:08 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="8b6ddcc38ecbed2f71b30fabadb8aa0b"; logging-data="727"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/psTPiQD9ntihcTQZUXoF13nIjOzukCLU=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Thunderbird/27.0 In-Reply-To: Cancel-Lock: sha1:ECLF8g0lUxVW2c7+2XO8kGfBnOI= Xref: csiph.com comp.lang.java.programmer:27569 On 2/21/2014 7:29 AM, Stuart wrote: > It is a pity that Java offers not so many code obfuscation techniques as > C++ does. I usually enjoy your C++ postings more (especially > a1a63f20-d25a-4e46-93be-7fb0582c7d5b@googlegroups.com, that was hilarious). I disagree, here is some wonderful code obfuscation. Were I more involved, I would have tried to find a better obfuscation than roman numerals for the main string, but, with any luck, the OP is reading this in a client with variable-width font and the text runs together as a whole lot of I's. public class Test { public static void main(String... args) { char[] K = new char[256]; int K = 0, Κ = 0; char[] К = ("ⅠⅠⅠⅠⅠⅠⅠⅠⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅢⅢⅢⅢⅢⅢⅢⅡⅥⅠⅠⅢⅢⅢⅢⅢⅢⅢⅢⅢⅢⅡⅡⅡⅢⅤⅣⅠ" + "ⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡ" + "ⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥ" + "ⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢ" + "ⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡⅢⅢⅢⅢⅢⅢⅢⅢⅤⅣⅠⅢⅠⅢⅡⅡⅥⅠⅠⅦⅡⅤⅠⅦⅣⅡⅣⅥⅠⅠⅦⅡⅡⅡ").toCharArray(); int Ⲕ = К.length; while (Κ < К.length) { switch (К[Κ]) { case 'Ⅰ': K++; break; case 'Ⅱ': K--; break; case 'Ⅲ': K[K]++; break; case 'Ⅳ': K[K]--; break; case 'Ⅴ': Ⲕ = Κ; if (K[K] == 0) Κ = K(К, Κ); break; case 'Ⅵ': Κ = Ⲕ - 1; break; case 'Ⅶ': System.out.print(K[K]); break; } Κ++; } } private static int K(char[] К, int Κ) { int K = 0; for (++Κ; Κ < К.length; Κ++) { if (К[Κ] == 'Ⅴ') K++; else if (К[Κ] == 'Ⅵ' && K-- == 0) return Κ; } return Κ; } } -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth