hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Another Typo Challenge

 
Reply to topic    hacker.org Forum Index » Challenges View previous topic
View next topic
Another Typo Challenge
Author Message
deutronium



Joined: 16 Dec 2008
Posts: 7

Post Another Typo Challenge Reply with quote
I wrote a PHP script which is trying all possible characters for all positions in the string and it found no solution.

Is there a special trick?
Am I looking in the wrong direction?
Can I assume that $x is zero before calling the given line?
The programming language of this challenge is still PHP, isn't it?
Is there a PHP function which name is just 1 character long (to be placed before the parentheses in the string)?


Last edited by deutronium on Tue Feb 10, 2009 8:53 pm; edited 1 time in total
Tue Feb 10, 2009 2:23 am View user's profile Send private message
rmplpmpl



Joined: 26 Oct 2008
Posts: 113
Location: Germany

Post Re: Another Typo Challenge Reply with quote
deutronium wrote:
I wrote a PHP script which is using eval() and is trying all possible characters for all positions in the string and it found no solution.

Is there a special trick?
Am I looking in the wrong direction?
Can I assume that $x is zero before calling the given line?
The programming language of this challenge is still PHP, isn't it?
Is there a PHP function which name is just 1 character long (to be placed before the parentheses in the string)?


It's 99% about mathematics and 1% about informatics.
Tue Feb 10, 2009 6:54 am View user's profile Send private message
MagneticMonopole



Joined: 07 Nov 2008
Posts: 26

Post Reply with quote
@deutronomium: Your approach did work just fine for me. (Well, I had perl feed expressions to fresh instances of a php interpreter. In your case, could previous eval()s have influenced the result of the current one?)

@rmplpmpl: Normally, I'd agree. In this particular case, not...
Tue Feb 10, 2009 8:30 am View user's profile Send private message
deutronium



Joined: 16 Dec 2008
Posts: 7

Post Reply with quote
>> In your case, could previous eval()s have influenced the result of the current one?

I don't hope so. I reassigned $x and $y in every iteration and I let my other variables end with two underscores so that this eval should not influence them.
Tue Feb 10, 2009 4:14 pm View user's profile Send private message
MerickOWA



Joined: 07 Apr 2008
Posts: 182
Location: HkRkoz al KuwaiT 2019 HaCkEr 101

Post Reply with quote
If you're trying all possible characters for all positions, you will find the answer eventually.

The challenge is still in PHP.
Tue Feb 10, 2009 5:25 pm View user's profile Send private message
deutronium



Joined: 16 Dec 2008
Posts: 7

Post Reply with quote
Thanks for the answers, it works now Smile

Although I explicity reassigned the variables in every iteration their values got corrupted somehow, after I added an explicit unset() for the variables it worked!
Tue Feb 10, 2009 8:51 pm View user's profile Send private message
wiz1989



Joined: 19 Feb 2009
Posts: 10
Location: Germany

Post Reply with quote
Just don't get the answer for this one.
I wrote a bruteforcing code like you did as well. But I made it with C#.
Also, it works fine for "Typo", but I don't get any results for "Another Typo". So I guess, it's php-depending, isn't it?
Thx for any hints =)
Thu Mar 12, 2009 10:48 am View user's profile Send private message
b0bA



Joined: 30 Dec 2008
Posts: 13

Post Reply with quote
I would say it's more a general programming style you miss, instead of a php-depending code only.
The hint by rmplpmpl is the best here. You should care about the 1% in computer science. I guess your BF-Algo is missing at least 0ne char Wink
Thu Mar 12, 2009 3:15 pm View user's profile Send private message
wodkahack0r



Joined: 05 Mar 2009
Posts: 9

Post Reply with quote
Hm. I figured out what char to change. But it always says: '.....' is incorrect. My solution is 100% correct as any calculator gets the right result from the modified version. Any idea what could be wrong?

- Forget it. My position was off-by-one. It works now.
Thu Mar 12, 2009 11:41 pm View user's profile Send private message
horst



Joined: 06 Mar 2009
Posts: 24
Location: Germany

Post Re: Another Typo Challenge Reply with quote
rmplpmpl wrote:
deutronium wrote:
I wrote a PHP script which is using eval() and is trying all possible characters for all positions in the string and it found no solution.

Is there a special trick?
Am I looking in the wrong direction?
Can I assume that $x is zero before calling the given line?
The programming language of this challenge is still PHP, isn't it?
Is there a PHP function which name is just 1 character long (to be placed before the parentheses in the string)?


It's 99% about mathematics and 1% about informatics.


Well, after many tries with a calculator and a C(++) program I must say that this is a little bit more about informatics than just 1%. Although this challenge isn't necessarily PHP dependent and is solvable without programming, in this case I had to brute force the PHP code to get the hint to the tiny difference between C and PHP.
Fri Mar 27, 2009 12:58 pm View user's profile Send private message
gfoot



Joined: 05 Sep 2007
Posts: 269
Location: Brighton, UK

Post Reply with quote
Maybe I'm misremembering, but I don't think this depended on a difference between C and PHP.
Sat Mar 28, 2009 12:45 am View user's profile Send private message
Chocoholic



Joined: 16 Feb 2009
Posts: 44
Location: UK

Post Reply with quote
True, the solution works in both C and C++ as well. However using an interpreted language as PHP helps if one really wants to brute-force it to save a few minutes thinking. A program in C would have to be recomplied every time something is changed.
Sun Mar 29, 2009 12:48 am View user's profile Send private message ICQ Number
magnus



Joined: 05 Mar 2009
Posts: 20

Post Reply with quote
THe solution even works in Java !!
Thu Mar 13, 2014 11:16 am View user's profile Send private message
Display posts from previous:    
Reply to topic    hacker.org Forum Index » Challenges All times are GMT
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.