Programming Riddle/Challenge (Timestamp/HMAC)

In summary, the conversation is about a person trying to complete an online "hacking" challenge by answering a question related to the Fibonacci sequence. However, they are facing difficulties as they are not able to answer fast enough. They try to edit the timestamp in the URL to see if it will help them proceed to the next level, but the website prompts them to match the HMAC with the given parameters. Another person suggests calculating a new HMAC hash using the timestamp and number, possibly using the HMAC-SHA512 algorithm. The conversation ends with a suggestion to use Python to calculate the new HMAC hash.
  • #1
jegues
1,097
3
I'm doing an online "hacking" challenge and I'm trying to get to the next level.

On the current level, we're given the Caption "Think fast", asked the following question,

"What is element x in the Fibonacci sequence, where element zero is 0?"

Where x is randomly generated.

When I compute the answer and submit it, it prompts me with another itteration of the question above (with a different value for x) and it says "Didn't answer fast enough". I've tried submitting answers as fast as I can with no avail, so there must be another way.

If we view the source code of the page, we see the following:
(I'm only going to post the portion I think is interesting/relevant)

Code:
<form action="herecomes9.php" method="get">
  <input type="text" name="answer" />
  <input type="hidden" name="timestamp" value="1311528704" />
  <input type="hidden" name="number" value="274" />
  <input type="hidden" name="hmac" value="6d423e4405ceb79022662fbf5d1d2885c51b6ada2ad5e99500a3fbc4d0170b4fd9c7fd22af9a7e542617a5924586ca7e41860e17289120d1a899f1bcac007df3" />
  <input type="submit" value="Answer" />
</form>

So my next idea was to edit the timestamp by changing the information contained in the url, like so

(Just an example to explain my doing, may not match answer, timestamp, hmac listed above in code)

http ://www.skullspace.net/2011/08-batman/herecomes9.php?answer=1&timestamp=1&number=1&hmac=e41bd1f9093a67b70ce9316b19abc1862ec35c5c0f746444d8018286bf19d9adb05a652c46b5de53b2d4fd6bfb2c1f848c8dc92a54e84d042953d6b48b30b0f9

If I submit that into my browser, we are given the caption, "Don't try to be clever, the HMAC has to match the parameters you were given."

This is where I'm stuck.

Does anyone have any ideas or hints as to how I can proceed to the next level? Can I somehow make the HMAC match? Is there another way entirely?

Thanks for the ideas/input/help!
 
Technology news on Phys.org
  • #2
Not particularly my area of expertise, but if you haven't already maybe try and calculate a new HMAC hash using your new timestamp and the number as the key? Based on the length maybe it's HMAC-SHA512?
 
  • #3
jhae2.718 said:
Not particularly my area of expertise, but if you haven't already maybe try and calculate a new HMAC hash using your new timestamp and the number as the key? Based on the length maybe it's HMAC-SHA512?

How do I go about calculating the new HMAC hash, using the timestamp and number?
 
Last edited:
  • #4
The Wikipedia article has links to some implementations, as well as descriptions: http://en.wikipedia.org/wiki/HMAC

I've never personally played around with HMACs before.
 
  • #5
This should do an HMAC with SHA-512 in Python:
Code:
[B][COLOR="DarkOrange"]import[/COLOR][/B] hashlib
[B][COLOR="DarkOrange"]import[/COLOR][/B] hmac

key = [COLOR="SeaGreen"]'the string that is your key'[/COLOR]
msg = [COLOR="SeaGreen"]'the string that is your message'[/COLOR]

[B][COLOR="DarkOrange"]print[/COLOR][/B](hmac.new(key, msg, hashlib.sha512).hexdigest())

I'm not sure what they're suing as the parameters for their HMAC. You'll want to play around with the answer, timestamp, and number.
 

1. What is a programming riddle/challenge?

A programming riddle/challenge is a task or problem that requires the use of coding and programming skills to solve. It often involves a specific set of rules, constraints, or a given scenario that needs to be solved using programming logic and techniques.

2. What is a timestamp and how is it used in programming riddles/challenges?

A timestamp is a unique identifier for a specific point in time, often used in programming to track and record the time when an event occurs. In programming riddles/challenges, a timestamp can be used to add an element of time-based logic or to generate a random element based on the current time.

3. What is HMAC and how does it relate to programming riddles/challenges?

HMAC stands for Hash-based Message Authentication Code and is a type of cryptographic security mechanism used to verify the integrity and authenticity of a message or data. In programming riddles/challenges, HMAC can be used to create secure solutions that require data validation or authentication.

4. Are programming riddles/challenges only for experienced programmers?

No, programming riddles/challenges can be enjoyed by programmers of all levels. Some riddles/challenges may be more difficult than others, but they often provide a fun and engaging way to practice and improve programming skills for all levels.

5. How can I find and participate in programming riddles/challenges?

There are many online platforms and communities that offer programming riddles/challenges for individuals to participate in and solve. Some popular options include coding forums, coding challenge websites, and social media groups. You can also create your own riddles/challenges and share them with others to solve.

Similar threads

  • Programming and Computer Science
Replies
29
Views
1K
  • Programming and Computer Science
3
Replies
75
Views
4K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Quantum Interpretations and Foundations
2
Replies
45
Views
3K
  • Programming and Computer Science
Replies
7
Views
5K
Replies
9
Views
3K
  • Programming and Computer Science
Replies
4
Views
6K
  • Programming and Computer Science
Replies
4
Views
3K
Back
Top