Oops. I hardcoded the string. I'll update my code...jayshields wrote:@hawley: I don't get it. Is this a variant of that brainf*ck language thing? I was gunna attempt something like that but it said pure PHP only. Your test page just shows a weird string. How do I reverse a string?
DevNetwork Obfuscated PHP Contest 2006
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
I updated the code to accept a variable. Also, changed the URL to:
http://jameshawley.com/forum/devnet.php?IO0=HAWLEYJR
http://jameshawley.com/forum/devnet.php?IO0=HAWLEYJR
I already fixed thatWeirdan wrote:sorry, hawleyjr, according to the rules your script must accept $_GET parameter with string to reverse.

hawleyjr wrote:I updated the code to accept a variable. Also, changed the URL to:
http://jameshawley.com/forum/devnet.php?IO0=HAWLEYJR
hawley's script deciphered (original version):
Code: Select all
<?php
$input = 'IIIi$oI1Io==1=' . 'Ii11io1ii1ioIOIo=';
echo $input;
$strlen = create_function ('$str','
$length=0;
for($i=0; $i < strlen($str); $i++) {
$length++;
}
return $length;
')
;
for($index = $strlen($input); $index >= 0; $index--) {
echo $input[$index];
}
?>
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Code: Select all
<?php
/*****************************************************************************/
/************************************** **************************************/
/************************************* *************************************/
/************************************ ************************************/
/*********************************** ***********************************/
/********************************** **********************************/
/********************************** (O) **********************************/
/********************************** **********************************/
/*********************************** ***********************************/
/************************************ ************************************/
/************************************* *************************************/
/************************************** **************************************/
/*****************************************************************************/
/*<>-->*/$s=(isset($_GET['s']))/*<>-->?<--<>*/?/*!$$et*/$_GET['s']:'';/*<--<>*/
/*_-^-_()<-0o0->()*/$sd=/*== -&<=> ==*/(isset($_GET['s']));/*_-^-_()<-0o0->()*/
/*(/'"'\)while- >< -([A-Za-z0-9?])`field`!=`yesterday =date($doggie)phpspat__*/
/*(*)*/$sc=/*require(['@#']);$beersgonewild=*/strlen($s);/*&$hawley->drunk($u*/
/*file_get_contents($somerandomarbitrarytextstringtogetfromalongassvariable);*/
/*$string='itwasacolddayinweeweelandwhenheawoketosoakedsheetsandapandlaughing*/
/*//\\_--_//\\*/$sn=/*'anotherlongabitrarystring';*/'';/*$0->make=&new Me();-*/
/*()*\__e();*/$se=/*$october=coldweatherexceptforburrito;*/'';/*chr(5).chr(1)*/
/*function malbec() {*/$y=/*global $warming,$kills,$fish,$for,$bbq;*/$sc-1;/**/
/*['^@#\s\t\n\\/'"";'/\\]*/while/*$we->gosailing();*/($y >= 0)/*try($_sleep);*/
/*throw(Exception $vestibule)*/{/*becauseIcan*/$sn.=/*if($s)*/$s{$y};/*||$y */
/*<-->kill($y);*/$y-=1;/*||$so-I-was-told;//butwhoreallyknowsthesthinganyway?*/
/*{*/}/*}--{*/if /*$y;>;<;str_replace(1,'1',$_1);*/($sd)/**/echo $sn;/*die();*/
/*$new_string='butikeptthepursuitforalongwhilethinkingthepimphaditcoming...';*/
/*****************************************************************************/
/************************************** **************************************/
/*****************************************************************************/
/************************************* *************************************/
/********************************** **********************************/
/******************************* *******************************/
/***************************** (O) *****************************/
/********************************** **********************************/
/*********************************** ***********************************/
/************************************ ************************************/
/************************************* *************************************/
/************************************** **************************************/
/*****************************************************************************/
?>This one works. Thanks Hawley, love that style. I screwed the pooch on it, but it looks pretty. Anyhow, new one to try is at http://www.codecompare.com/sonew.php. Blank on load, reverse string on passing of ?s=stringtoreverse.
lol, I could have given that to you if ya wanted ...Weirdan wrote:hawley's script deciphered (original version):Code: Select all
<?php $input = 'IIIi$oI1Io==1=' . 'Ii11io1ii1ioIOIo='; echo $input; $strlen = create_function ('$str',' $length=0; for($i=0; $i < strlen($str); $i++) { $length++; } return $length; ') ; for($index = $strlen($input); $index >= 0; $index--) { echo $input[$index]; } ?>
I’m starting to sense some criticism on the level of code I submitted. However, according to Wikipedia
Therefore, you don’t necessarily have to write a complex 3 page function when all you need to do is make code ‘Hard to Read’Obfuscated code is source code that is (perhaps intentionally) very hard to read and understand.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Code: Select all
<?php while($_=(!$_?72:($_==72?101:($_==101?108:($_==108?109:($_==109?111:
($_==111?44:($_==44?32:($_==32?87:($_==87?112:($_==112?114:($_==114?666:
($_==666?100:($_==100?33:($_==33?0:1)))))))))))))))echo chr($_==109?108:($_==112?
111:($_==666?108:($_))));?>I've noticed a lot of comment filler in other code.. does that even count?
EDIT: Sorry just read the thread as Obfuscated code.. didn't relise there was a spec untill I just read it completly
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
