Original Usenet thread from alt.ascii-art, started 15 Jul 2003.
ASCII art from sourcecode as image
alt.ascii-art
· 10 messages · 15 Jul 2003 - 20 Jul 2003
I have seen both linux source codes and some scripts for my company rendered as images - reads formated with extra blanks line feeds etc. to look like some image if displayed using small enough letters. (without inserting/deleting anything changing the source from the compilers point of view) I am sure there has to be some converter to do that source2asciiArt conversion using a given image as formating mask but i cannot find such a tool. Where are they??? plz help erik
On Tue, 15 Jul 2003, Erik Itter wrote: > > I have seen both linux source codes and some scripts for my company rendered > as images - reads formated with extra blanks line feeds etc. to look like > some image if displayed using small enough letters. (without > inserting/deleting anything changing the source from the compilers point of > view) > > I am sure there has to be some converter to do that source2asciiArt > conversion using a given image as formating mask but i cannot find such a > tool. Where are they??? Not only do you have to know the "formatting mask", you also have to know the formatting rules of the language you're using. For example, in C and C++ you can't add whitespace in the middle of an identifier, or in the middle of a multi-character operator like -> or ++. A program would have to have a list of "atomic symbols" like '++' and 'if' that could *never* be changed, and probably a list of "identifiers" like 'count' and 'foobaz' that *could* be changed, as long as they were changed everywhere. Ditto rules about comments (both single-line and delimited varieties). It would be a nice programming exercise to write a very simple "formatter" in this vein; you might even try it yourself, if you know a programming language. To create a generic "formatter" taking into consideration everything I said above: that would be really challenging, IMO. -Arthur ObAscii: terribly un-ergonomic monitor-keyboard setup _/\ _- \\ --\ \\-----. /-_ \ _\\ _ `. / -_ \.-'\ -~-\#c_ `. / ~~~~~~ ~~~~ `. / `.
_.--- Erik Itter spoke in alt.ascii-art --------._ > I have seen both linux source codes and some scripts for my company rendered > as images - reads formated with extra blanks line feeds etc. You might want to have a look at <url:http://www.ioccc.org/> It may take a little while but you will find some nice ones like this: <url:http://www0.us.ioccc.org/2001/williams.c> > I am sure there has to be some converter to do that source2asciiArt > conversion Not that I am aware of. Last I checked it is all done by hand. '---...____ Faux_Pseudo ________________...---~~~ -- ICQ=66618055 : http://asciipr0n.com/fp UPDATED=05/06 YIM=faux_pseudo : Rev: 2/anthrax/killer_as/02_-_Only.mp3 These 34 bytes : Now: /01_-_bud_e._luvbomb_and_satan's_lounge_band.mp3 Are up for sale : Fwd: de_-_walking_in_london_-_06_-_city_screaming.mp3
Erik Itter wrote: > I have seen both linux source codes and some scripts for my company rendered > as images - reads formated with extra blanks line feeds etc. to look like > some image if displayed using small enough letters. (without > inserting/deleting anything changing the source from the compilers point of > view) For perl there is Acme::EyeDrops. It doesn't just format the program, it obfuscates it too. -- 8< -- cut here -- >8 -- #!/usr/bin/perl -w eval eval '"'. ('#'). '!'.'/' .('[' ^'.' ) .('['^'('). ("\["^ ')')."\/".( '`'|'"').('`'| ')').( '`'|'.') .'/'. ( '['^'+').('`'|'%').('[' ^')').('`'|',').('{' ^'[').'-'.('['^',').('!' ^'+').('['^'.').('['^ '(').('`'|'%').('{'^('[')).( '['^'(').('['^'/').( '['^')').('`'|')').('`'|'#').("\["^ ('/')). ';'.('!'^'+').('['^'+').('['^"\)").( '`'|')').('`'|'.').('['^'/').('{'^'[').'\\'.'"'.('`'|'(').( '`'|'%').('`'|',').('`'|',').('`'|'/').','.('{'^'[').('['^',' ).('`'|'/').('['^')').('`'|',').('`'|'$').'\\'.'\\'.('`'|"\."). '\\'.'"'.';'.('!'^'+').'"';$:='.'^'~';$~='@'|'(';$^=')'^'[';$/= '`'|'.';$_='('^'}';$,='`'|'!';$\=')'^'}';$:='.'^'~';$~='@'|'('; $^=')'^'[';$/='`'|'.';$_='('^'}';$,='`'|'!';$\=')'^'}';$:="\."^ '~';$~='@'|'(';$^=')'^'[';$/='`'|'.';$_='('^'}';$,='`'|('!');$\= ')'^'}';$:='.'^'~';$~='@'|'(';$^=')'^'[';$/='`'|'.';$_='('^'}'; $,='`'|'!';$\=')'^'}';$:='.'^'~';$~='@'|'(';$^=')'^'[' ;($/)= '`'|'.';$_='('^'}';$,='`'|'!';$\=')'^'}';$:='.'^'~'; ($~)= '@'|'(';$^=')'^'[';$/='`'|'.';$_='('^'}';$,=('`')| "\!"; $\=')'^'}';$:='.'^'~';$~='@'|'(';$^=')' ^'[';$/= '`'| (( '.'));$_='('^'}';$,='`'|"\!";$\= ')'^'}'; ($:) ='.'^"\~"; $~='@'|'(' ;$^=')'^ '[';$/= '`' |('.');$_= '('^'}';$, ='`'|'!' ;$\=')' ^+ "\}";$:= '.'^'~';$~ =('@')| '(';$^ =')'^'[' ;$/=('`')| '.';$_= "\("^ '}';$,= '`'|'!';$\ ="\)"^ '}';$: =('.')^ "\~";$~= ('@')| "\("; $^=')' ^"\["; $/='`' |'.'; ($_)= ('(')^ '}';$, ='`'| "\!"; $\=')'^ '}';$: ='.' ^'~'; $~='@'|'(' ;$^= ')'^ "\[";$/= '`'| '.'; $_=('(')^ '}'; ($,) ='`'|'!';$\ =')'^ "\}"; $:='.'^'~';$~= ('@')| "\("; $^="\)"^ '['; $/='`'| '.';$_= '('^'}'; $,="\`"| '!';#; -- 8< -- cut here -- >8 -- -- | Harry Mason | .------------. | .___, |"Whatever you do will be | | University of | | hjm200 @ | | ___('v')___ | insignificant. However, | | Southampton | | zepler.net | | `"-\._./-"' | it is vitally important | | England | '------------' | hjm ^ ^ | that you do it." Gandhi |
On Wed, 16 Jul 2003, Harry Mason wrote: > > Erik Itter wrote: > > I have seen both linux source codes and some scripts for my company rendered > > as images - reads formated with extra blanks line feeds etc. to look like > > some image if displayed using small enough letters. (without > > inserting/deleting anything changing the source from the compilers point of > > view) > > For perl there is Acme::EyeDrops. It doesn't just format the program, it > obfuscates it too. > #!/usr/bin/perl -w > eval eval '"'. ('#'). > '!'.'/' .('[' > ^'.' ) .('['^'('). ("\["^ > ')')."\/".( '`'|'"').('`'| ')').( > '`'|'.') .'/'. ( '['^'+').('`'|'%').('[' > ^')').('`'|',').('{' ^'[').'-'.('['^',').('!' <snip most of very nice program> > "\}"; $:='.'^'~';$~= ('@')| > "\("; $^="\)"^ '['; $/='`'| > '.';$_= '('^'}'; > $,="\`"| '!';#; Very nice! 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. Out of curiosity: Why *two* nested 'eval's at the start of this program? And what does ('['^'.') mean? 0x5B^0x2E = 0x75 = 'u', or is there some deeper magic at work here? :) -Arthur __ __ _ . \-' \-_ \<_ \_ --------------
my god... Now I remember why I don't do perl :) BoD
Arthur J. O'Dwyer wrote: > > On Wed, 16 Jul 2003, Harry Mason wrote: >> >> Erik Itter wrote: >> > I have seen both linux source codes and some scripts for my company >> > rendered as images - reads formated with extra blanks line feeds etc. to >> > look like some image if displayed using small enough letters. (without >> > inserting/deleting anything changing the source from the compilers point >> > of view) >> >> For perl there is Acme::EyeDrops. It doesn't just format the program, it >> obfuscates it too. > >> #!/usr/bin/perl -w >> eval eval '"'. ('#'). >> '!'.'/' .('[' ><snip most of very nice program> > > 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. > Out of curiosity: Why *two* nested 'eval's at the start of this program? The inner "eval" constructs the text of the original program. You can see this if you replace the outer "eval" with "print": #!/usr/bin/perl -w use strict; print "hello, world\n"; which is the original source code. > 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. :) -- | Harry Mason | .------------. | .___, |"Whatever you do will be | | University of | | hjm200 @ | | ___('v')___ | insignificant. However, | | Southampton | | zepler.net | | `"-\._./-"' | it is vitally important | | England | '------------' | hjm ^ ^ | that you do it." Gandhi |
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 '"'. ('#'). > >> '!'.'/' .('[' > ><snip most of very nice program> > > > > 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. :) > > Out of curiosity: Why *two* nested 'eval's at the start of this program? > > The inner "eval" constructs the text of the original program. You can see > this if you replace the outer "eval" with "print": > > #!/usr/bin/perl -w > use strict; > print "hello, world\n"; > > which is the original source code. Aha. [I certainly wouldn't've run that random Perl program on *my* machine! ;-)] > > 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... -Arthur
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 '"'. ('#'). >> >> '!'.'/' .('[' >> ><snip most of very nice program> >> > >> > 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. :) -- | Harry Mason | .------------. | .___, |"Whatever you do will be | | University of | | hjm200 @ | | ___('v')___ | insignificant. However, | | Southampton | | zepler.net | | `"-\._./-"' | it is vitally important | | England | '------------' | hjm ^ ^ | that you do it." Gandhi |
Harry Mason <spa...@no.spam> wrote in message news:<slr...@tarrant.ecs.soton.ac.uk>... > 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 '"'. ('#'). > >> >> '!'.'/' .('[' > >> ><snip most of very nice program> > >> > > >> > 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. /-\
Related ASCII art in the Gallery
Explore these categories from our collection of 11,000+ artworks:
__ . . __ (o.\ \/ /.o) \__\/\/__/ /O /==\ O\ (;O/ \/ \O;)
_______ |.-----.| || jgs || ||_ _|| `--)-(--` __[=== o]___ |:::::::::::|\ `-=========-`()
,sSSs ,SSSS_/ ,_ sS/`))\// sS//|_(_/ _, SS\\\ `""-.-'` / sSS` jgs-==-'`'-._\
___________ | _______ | | | | | | | | | | | | | | |_______| | |___________|
//O\\
|\/\/\/| | | | | | (o)(o) C _) | ,___| | / /____\
Make your own ASCII art
Turn images, text or 3D into ASCII, or draw your own – right in your browser.
About this thread.
These messages were posted publicly to the newsgroup
alt.ascii-art
in 2003 and are mirrored here unchanged as part of the Historic Archives – only email addresses are masked.
The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can.
Are you one of the authors? Contact us to get your posts attributed, connected to your artist profile, or removed.
Report this message
Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.