X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f996b,fd4f3d79f18d7426 X-Google-Attributes: gidf996b,public X-Google-ArrivalTime: 2003-07-20 06:36:20 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: ajsavige@yahoo.com.au (Andrew Savige) Newsgroups: alt.ascii-art Subject: Re: [ot] Perl (was: ASCII art from sourcecode as image) Date: 20 Jul 2003 06:36:20 -0700 Organization: http://groups.google.com/ Lines: 97 Message-ID: References: NNTP-Posting-Host: 203.202.109.33 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1058708180 16055 127.0.0.1 (20 Jul 2003 13:36:20 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 20 Jul 2003 13:36:20 GMT Xref: archiver1.google.com alt.ascii-art:24288 Harry Mason wrote in message news:... > Arthur J. O'Dwyer wrote: > > > > On Thu, 17 Jul 2003, Harry Mason wrote: > >> > >> Arthur J. O'Dwyer wrote: > >> > On Wed, 16 Jul 2003, Harry Mason wrote: > >> >> #!/usr/bin/perl -w > >> >> eval eval '"'. ('#'). > >> >> '!'.'/' .('[' > >> > > >> > > >> > The OP has told me via e-mail that he really wants Java, of course. > >> > So unfortunately the 'eval big_long_string' trick that I think is > >> > at the root of EyeDrops' approach wouldn't work. > >> > >> Bear in mind that this is actually an obfuscator, not just a reformatter. > >> You could achieve a similar effect in most languages, including Java, by > >> creative use of white space, string concatenation, etc. > > > > Certainly not in C or C++, and not in the vanilla beginner's Java I'm > > familiar with. They don't have any equivalent of "eval", unless you > > build your own interpreter on top of everything. :) > > Even without eval(), you can still rename variables, concatenate strings, > and insert comments. > > import > java.io.PrintStream; > public class ASmileyFace { > public static void main(String[] > a) { PrintStream out = System.out ; > out.print( "This" + " is " + > "both a " + "reform"+ > "atted J" + "av" + "a prog"+ > "ram, an" + "d a sm"+ > "i".concat( "ley " + "face. Th"+ > "is " + "shows how to " + "f"+ > "orm" + "at Jav" + "a "+ > "usi" +"n"+ > "g whitespace only.") > ) ;} } > > As for C, I expect you can find some examples at the IOCCC: > http://www.ioccc.org/ > > >> > And what does ('['^'.') mean? 0x5B^0x2E = 0x75 = 'u', or is there some > >> > deeper magic at work here? :) > >> > >> ('['^'.') corresponds to the "u" in "use strict". Obfuscating is so much more > >> effective if you don't use any alphanumerics in your source code. :) > > > > Yeah - but does Perl specify ASCII? And in a language where x is an > > operator, I wasn't sure but that ^ meant something even weirder for > > strings... > > It's just doing bitwise XOR on the ASCII values of each character. See the > section "Bitwise String Operators" in perlop(1). Perl source code is ASCII > unless you add "use utf8;"; then it can be UTF-8 - but doing bitwise > operations on UTF-8 strings will no doubt get you into trouble one day. :) Main link for Acme::EyeDrops: http://search.cpan.org/dist/Acme-EyeDrops/ You can download the module or browse its documentation from here. It seems you can also directly browse its documentation from this link: http://search.cpan.org/dist/Acme-EyeDrops/lib/Acme/EyeDrops.pm As Acme::EyeDrops author, I'd like to clarify a few points: 1) Why the double eval? To allow encoding of escapes within double quoted strings, for example "\n" for a hard newline. The sightly encoding can even encode binary files since Perl can escape arbitrary octal/hex chars inside double quoted strings. (I call it "sightly" because it contains no unsightly letters or numbers). 2) In many cases, the double eval can be eliminated by embedding the program inside a regular expression (Regex attribute), yielding a "pure" sightly program, free of all alphanumerics. See the "Somersaulting Camel" section of the documentation for an example of such a camel-shaped program that somersaults across the screen when run. 3) The Text attribute (pour_text) function can be used to pour plain text into an arbitrary shape (see the "Snowflakes" section of the documentation for an example). This might be useful to make it less tedious to pour a Java program into an arbitrary shape, say. Bear in mind, however, that this simple function knows nothing of Java syntax, so (unlike the sightly encoded camel) you will need to manually touch it up by hand. Shameless plug: the current ascii art images (.eye files) can be browsed on-line at: http://search.cpan.org/src/ASAVIGE/Acme-EyeDrops-1.40/lib/Acme/EyeDrops/ but I am no ascii artist, so contributions from this newsgroup are most welcome and will be acknowledged in future distributions. Please bear in mind, though, that ascii art suitable for EyeDrops is very limited in that it must be quite large and simple (like the camel example given earlier), so as to allow you to fill it with arbitrary program code. /-\