"be consistent" PerlMonks

### Line Noise

by kilinrax (Deacon)
 on May 23, 2001 at 21:20 UTC Need Help??

```#!/usr/bin/perl -w

use strict; \$\=\$/;\$_=q&&;s()/#?=>\$":}\~>\\!;/;\$/=~s~
~s{;};\$")!{\$"\\:<_!;~e;y{%*-.\$'&(#-<}\$@-~\$s;{y(;-?)=
r-{)!=s;y\$T-_\$`-|\$;y}{-~}l-\}};s{!}\$Y<\$g&&redo}print

Edit: chipmunk 2001-05-23

Replies are listed 'Best First'.
Re: Line Noise (deobfuscation attempt)
by ChemBoy (Priest) on May 24, 2001 at 04:02 UTC

This is really, really, cool. I'm going to desecrate it by deobfuscating it merely because it gave me a deeper appreciation of how cool it is (and because I feel somewhat clever for being able to).

First, let's make it a little more readable...

Re: Line Noise
by tachyon (Chancellor) on May 24, 2001 at 06:55 UTC
```# line noise by kilinrax
#
# another read and run dissection by tachyon
#
# I needed to rearrange the line breaks and add
# a space between the = and r on at the begining
# of the third line to make this run as shown below

use strict; \$\=\$/;\$_=q&&;s()/#?=>\$":}\~>\\!;/;\$/=~
s~~s{;};\$")!{\$"\\:<_!;~e;y{%*-.\$'&(#-<}\$@-~\$s;{y(;-?)
= r-{)!=s;y\$T-_\$`-|\$;y}{-~}l-\}};s{!}\$Y<\$g&&redo}print;

# this is an awesome obfu, here is a quick dissect
# first the exact original code with some whitespace

use strict;
\$\=\$/;
\$_=q&&;
s()/#?=>\$":}\~>\\!;/;
\$/ =~ s~~s{;};\$")!{\$"\\:<_!;~e;
y{%*-.\$'&(#-<}\$@-~\$s;
{
y(;-?)= r-{)!=s;
y\$T-_\$`-|\$;
y}{-~}l-\}};
s{!}\$Y<\$g && redo
}
print;

# make it a bit more readable by using
# the usual / for our s and tr (y); also the
# bareblock rearranged, and now executes only once
# as s/!/Y</g is only true once and we can do it
# before all the transliteration

use strict;
\$\="\n"; # set output rec sep to newline, neat trick!
\$_='';
s//#?=>\$":}\~>\\!;/;
\$/ =~ s//s{;};\$")!{\$"\\:<_!;/e;
tr/%*-.\$'&(#-</@-~/s;
while (s/!/Y</g){
tr/;-?/ r-{)!/s;
tr/T-_/`-|/;
tr/{-~/l-\}/;
}
print;

# here it is with the \$/ =~ s///e simplified as we only
# want the effect of the code evaled in the second part
# the unecessary while block has been removed
# the unecessary /s modifiers on the trs are gone
# as there are no duplicate chars to squash
# and some print statements show the secrets

use strict;
\$\="\n";
\$_='';
s//#?=>\$":}\~>\\!;/; print "1: \$_";
s/;/\$")!{\$"\\:<_!/;  print "2: \$_";
tr/%*-.\$'&(#-</@-~/; print "3: \$_";
s/!/Y</g;            print "4: \$_";
tr/;-?/ r-{)!/;      print "5: \$_";
tr/T-_/`-|/;         print "6: \$_";
tr/{-~/l-\}/;        print "7: \$_";
print;

# You can see what happens, the reason the changes
# occur are that the - within the tr (y) has a special
# meaning - it specifies a range of chars to
# transliterate. Although A-Z is common *-. is OK
# too, and certainly less readable!
#
# This is an really unreadable obfu, even in this state
# Top effort!!!
#
# tachyon
Re: Line Noise
by larryk (Friar) on May 24, 2001 at 00:21 UTC
I get the following as output
```Jtrs anoshe
b
larryk
Try it now; there was an unwanted space character at the end of each line, which interfered with the operation of the code.
++ now

Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://82635]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2023-12-06 15:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
What's your preferred 'use VERSION' for new CPAN modules in 2023?

Results (30 votes). Check out past polls.

Notices?