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
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_ `. /
~~~~~~ ~~~~ `. /
`.
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
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 |
> #!/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
__ __ _ .
\-' \-_ \<_ \_
--------------
Now I remember why I don't do perl :)
BoD
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. :)
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
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.
/-\