newbie 4th JaPH

P

Pedro Graca

How do you like this newbie's 4th JaPH attempt?

-- (not a .sig now)
#!/usr/bin/perl -w 2003-11-07 Pedro Graca - JaPH4
@1=(2399670,250604053953,1455299,5114679918);foreach$2(@1){$s='';
while($2){$c=$2%49;$2=int($2/49);$s.=(chr(($c+64)^32))}push@p,$s}
print join(' ',@p),"\n"
 
E

Eric J. Roode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

How do you like this newbie's 4th JaPH attempt?

-- (not a .sig now)
#!/usr/bin/perl -w 2003-11-07 Pedro Graca - JaPH4
@1=(2399670,250604053953,1455299,5114679918);foreach$2(@1){$s='';
while($2){$c=$2%49;$2=int($2/49);$s.=(chr(($c+64)^32))}push@p,$s}
print join(' ',@p),"\n"

Not bad. I'm somewhat surprised that you can use $2 as a loop variable. I
wonder if that's a bug.

Why join @p to print it? Why not just print "@p\n"?

- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP66gxmPeouIeTNHoEQLxjwCgnGzBs3abvzy7yjjWkkJnGrEoMWMAoI7V
fcS9F70qM9EoJ3NW1yF8K3N4
=Vmkg
-----END PGP SIGNATURE-----
 
P

Pedro Graca

Eric said:
Pedro Graca wrote
Not bad.

Thank you :)

I'm somewhat surprised that you can use $2 as a loop variable. I
wonder if that's a bug.

I wanted to use @1, $2, $3 (for $s) and $4 (for $c), but perl (or
Perl?) complained.
I don't see any references to $2, $3, and $4 in perldoc perlvar except
for regexes which I'm not using.

What do they mean?
Or where can I find out what do they mean?

Why join @p to print it? Why not just print "@p\n"?
Changed!


Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

I tried to understand your JaPH ... finally made it!
with a lot of trial and error in recoding it, trying to guess where the
lists started and ended and where the instructions started and ended.
 
B

Ben Morrow

Pedro Graca said:
I wanted to use @1, $2, $3 (for $s) and $4 (for $c), but perl (or
Perl?) complained.
I don't see any references to $2, $3, and $4 in perldoc perlvar except
for regexes which I'm not using.

That is their only significance: they hold the contents of the
bracketed sections of the last successful match.

perlvar states they are read-only, which is why Perl complained about
your use of $3 and $4. That it didn't complain about $2 is wrong, and
is (I think) to do with the special way that globals are treated when
used as the iterator of a for loop. @1 is (currently) not special, but
you should not use it as it is reserved for Perl, which means it may
become so one day.

(Note, for your (probable) immediate change, that $a and $b are
special as well... :)

Ben
 
M

Michele Dondi

How do you like this newbie's 4th JaPH attempt?

-- (not a .sig now)
#!/usr/bin/perl -w 2003-11-07 Pedro Graca - JaPH4
@1=(2399670,250604053953,1455299,5114679918);foreach$2(@1){$s='';
while($2){$c=$2%49;$2=int($2/49);$s.=(chr(($c+64)^32))}push@p,$s}
print join(' ',@p),"\n"

Personally I like it. Only, it is not too obfuscated and it doesn't
exhibit an intriguing idea either. (like Abigail's ones do, for
example!)

Also, while JAPHs are not generally required to be warnings or strict
safe, it is not so bad that they are. But IIRC I've never seen an
explicit shebang line unless it was really necessary to the logic of
the code.

Last, IMHO lines should be better equal-sized, if possible. If it
matters I think my first and only JAPH (.sig here) sort of sucks too.


Michele
 
P

Pedro Graca

Ben said:
That is their only significance: they hold the contents of the
bracketed sections of the last successful match.

perlvar states they are read-only, which is why Perl complained about
your use of $3 and $4. That it didn't complain about $2 is wrong, and
is (I think) to do with the special way that globals are treated when
used as the iterator of a for loop.

Thank you for a very good explanation.

@1 is (currently) not special, but
you should not use it as it is reserved for Perl, which means it may
become so one day.

(Note, for your (probable) immediate change, that $a and $b are
special as well... :)

hehe, thanks again
 
P

Pedro Graca

Michele said:
Personally I like it. Only, it is not too obfuscated and it doesn't
exhibit an intriguing idea either. (like Abigail's ones do, for
example!)

Well ...
JaPHs really are for experts -- I'm trying to reach that level :)

Many times I try to understand a JaPH I give up because I can't see
where things end

Also, while JAPHs are not generally required to be warnings or strict
safe, it is not so bad that they are. But IIRC I've never seen an
explicit shebang line unless it was really necessary to the logic of
the code.

Last, IMHO lines should be better equal-sized, if possible. If it
matters I think my first and only JAPH (.sig here) sort of sucks too.

Thanks for the pointers.

I'm trying to understand Your JaPH.
All those dots are really obfuscating me ... but I'm not giving up!
 
M

Michele Dondi

I'm trying to understand Your JaPH.
All those dots are really obfuscating me ... but I'm not giving up!

Oh, it's not that difficult:

$\=q.,.,$_=q.print' ,\g,,( w,a'c'e'h,,map{$_-=qif/g/;chr
}107..q[..117,q)[map+hex,split//,join' ,2B,, w$ECDF078D3'
F9'5F3014$,$,];];$\.=$/,s,q,32,g,s,g,112,g,y,' , q,,eval;

Basically it consists of two statements:

$\=q.,.,$_=q.print' ,\g,,( w,a'c'e'h,,map{$_-=qif/g/;chr
}107..q[..117,q)[map+hex,split//,join' ,2B,, w$ECDF078D3'
F9'5F3014$,$,];];

$\.=$/,s,q,32,g,s,g,112,g,y,' , q,,eval;

The first one sets $\ and $_.

To be precise it does something like

$_="print' ,\g,,( w,a'c'e'h,,map{$_-=qif/g/;chr
}107" .
"..117,q)[map+hex,split//,join' ,2B,, w$ECDF078D3'
F9'5F3014$,$,];";

Now $_ contains another JAPH, only a bit "shuffled", in fact...

The second one appends something to $\ and makes some substitutions in
$_. Then $_ is eval()ed: change eval() to print() and you'll see a
"less obfuscated core", modulo an extra "," at the end.


Michele
 
P

Pedro Graca

Michele said:
Oh, it's not that difficult:

Thank you for the analysis.


I know now why your JaPH has "hacker" with a lowercase "h" :)

Maybe you could have used one of the 107..117 for an "H" (maybe 109)
.... but then your code would get even more complicated

[...] change eval() to print() and you'll see a
"less obfuscated core", modulo an extra "," at the end.

That stupid "," -- it isn't doing _anything_ !!!!
I even thought it might get into the substitutions or something, took me
a long time to discard it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top