Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

/^[^A-Za-z0-9 ]*$/

by Roger_B (Scribe)
on Sep 30, 2005 at 00:13 UTC ( #496290=obfuscated: print w/replies, xml ) Need Help??

OK since my lowercase-only JAPH seems to be nothing special on its own, here is a no-alphas JAPH to complement it. I use only non-alphanumeric printable ASCII characters, excluding whitespace. Underscores are allowed. Enjoy.

#! /usr/bin/perl use warnings; use strict; $_=('_[]@^'^'/>/,~')."-".('>]'^'[}')."\"".('^])@*{.|~%{{]\\-'^'./@.^[} +(:`))}-\\')."(".('*\\(]{\\./(@[-^-%^,{(!]+>^'^'@)[)[=@@\\(>_~]@,@[@@> +@[,')."\\".('.'^'@').")\"";`$_`

It works on my PC, it should work for most of you. Try deparsing it if you have problems.

Thanks to chester for a partial solution.

Replies are listed 'Best First'.
Re: /^[^A-Za-z0-9 ]*$/
by ambrus (Abbot) on Sep 30, 2005 at 08:16 UTC

    Very nice obfuscation. I definitely couldn't read anything from it when I looked at the source.

    Here's a way to make it resistant against Deparse. (It still doesn't print the canonical comma, I'm lazy to do that.)

    $;="+[^,}",$/=($;^'[>,@]')."-".(('^|*!]@~/*%*..*]]./[@;.^,^\,{@\?@;,"} +@`|')[$;]^';^]@/.^^[~`[]^}<@@/(^\~|;.@[(=\+^^~!.=^'),`$/`

    Update: see also Re: my JaPh,.

Re: /^[^A-Za-z0-9 ]*$/
by deep submerge (Scribe) on Sep 30, 2005 at 18:22 UTC

    Using Deparse just takes away all the magic, leaving me with a little to no understanding of how it works... =P

    How do you translate from "noise" to alphanumeric characters?

      Yes, that amused me when I tried it. My clue about deparse was in case anyone's perl wasn't called 'perl' or wasn't on the path; the deparsed version shows that part of how it works.

      Here's a partially de-obfuscated version:

      $_ = ( '_[]@^' ^ '/>/,~' ) . # 'perl ' '-' . # '-' ( '>]' ^ '[}' ) . # 'e ' '"' . # '"' ( '^])@*{.|~%{{]\\-' ^ './@.^[}(:`))}-\\' ) . # 'print STDERR qq' '(' . # '(' ( '*\\(]{\\./(@[-^-%^,{(!]+>^' ^ '@)[)[=@@\\(>_~]@,@[@@>@[,' ) . # 'just another perl hacker' '\\' . # '\' ( '.' ^ '@' ) . # 'n' ')"'; # ')"' `$_`

      basically it's a concatenation of strings, using the bitwise xor operator '^' to generate alphanumeric characters, per chester's line noise JAPH. For example the 'p' in the first 'perl' comes by xoring '_' and '/':

      perl -e "print '_' ^ '/'" p

      Deparsing de-obfuscates it because the entire xoring and concatenation is made up of literals, so the compiler calculates the result and substitutes it into the compiled version. Deparse simply translates the compiled code back into Perl code. A simpler example might be:

      perl -MO=Deparse -e "print 2 * 2" print 4; -e syntax OK

      '2 * 2' is translated to '4' at compile time and deparse leaves it that way.



      P.S. blokhead pointed out to me that this too has been done before!

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://496290]
Approved by grinder
Front-paged by grinder
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2023-04-01 17:34 GMT
Find Nodes?
    Voting Booth?

    No recent polls found