Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Stuart Newsgroups: comp.lang.java.programmer Subject: Re: java code Date: Sat, 22 Feb 2014 13:57:33 +0100 Organization: A noiseless patient Spider Lines: 63 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 12:57:34 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="21aac22f8896a48c2c25e23bfecada7e"; logging-data="30965"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//c1ZiVW2WQkUsbgjpp7u7mB6nGJTFW0c=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: Cancel-Lock: sha1:GHoT8W5V9IA4ArquSe9ekKLl8CM= Xref: csiph.com comp.lang.java.programmer:27571 On 2/21/2014, Stuart wrote: >> It is a pity that Java offers not so many code obfuscation >> techniques as C++ does. On 02/22/14, Joshua Cranmer wrote: > 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 Κ; > } > } Wow, that's awful. At first, this code wouldn't run because for some reasons Thunderbird treated the K in the lines char[] K = new char[256]; and the first K in this line int K = 0, Κ = 0; both as 0x4B, thus making the code erroneous. Or maybe it was one of the newsservers that made the substitution. I never knew that Java allowed Unicode letters in the source code, so I even learned something new today. Thanks for sharing, Stuart @Stefan Ram: Sorry, Joshua clearly blew you out of the water...