0
$\begingroup$

Imagine we have a magic box that will open only if we pronounce the secret words. Everybody at the beginning of the game have some verifiable proof of the correct secret words.
During the first phase all contestants will say their guesses for the secret words.
On a second phase the magic box will open if any of the contestants said the secret words. And using the proof provided and the beginning of the game you will be able to verify the secret words are the same, and the box is not trying to trick you. If none of the contestants guessed the secret words the box will tell the secret words and the game will start again resetting the secret words and offering a new proof.

My own guess
Based on my limited cryptography knowledge my implementation will be as follows: The proof provided at the beginning of the game would be a hash of the encrypted secret. When the secret is revealed on the second phase, a key and method to encrypt the secret is also provided, so contestants will be able to encrypt themselves the secret and compared the hash to the proof provided at the beginning. I would use a simple symmetric encryption method and a md5 hash for the proof.

Please let me know of your thoughts and if you get a better approach of the problem.

$\endgroup$
4
  • $\begingroup$ I would suggest using SHA2/3 over md5, because as unlikely as it is, it is technically possible that someone could say an incorrect word, that when hashed, happens to match the known hash, due to collisions $\endgroup$ – SamG101 Jan 24 '20 at 11:10
  • $\begingroup$ but the md5 hash is just an initial proof, during the revealing phase both secret and key to encrypt will be revealed. Md5 collision for the encrypted secret is irrelevant if you can reconstruct the encryption steps using the key and the secret $\endgroup$ – Veilkrand Jan 24 '20 at 11:31
  • 1
    $\begingroup$ Why can't the box just give a key for a hmac of the secret: hash-based and requires a key. $\endgroup$ – SamG101 Jan 24 '20 at 12:16
  • $\begingroup$ @SamG101 hmac will absolutely works using a good key $\endgroup$ – Veilkrand Jan 24 '20 at 14:02
1
$\begingroup$

HMAC is what you need:

  1. The HMAC of the secret is provided at the start of the round
  2. The box gives out the HMAC key at the end of the round
  3. If someone guessed the word correctly in the round, then the box gives the HMAC key out to all the contestants, so everyone can verify that the box is telling the truth that a contestant was correct
  4. If no-one gets the answer by the end of the round, then the box can share the key, and the contestants can then verify that the secret is in fact what the box claimed it to be, and that the box isn't lying.

HMAC is hash based, and relies on a symmetric key, which satisfies your requirements

$\endgroup$
2
  • $\begingroup$ I want to share some points from my implementation using hmac: The secret will be hashed with the current time and date as strings for validation purposes and as a salt in case the secrets are a fixed set of words. Key will be at least 128 bits. The hashing method is a sha3-256. $\endgroup$ – Veilkrand Jan 24 '20 at 23:53
  • $\begingroup$ Sounds good - only point I'd say is that HMAC key lengths are recommended at 256 bits, but technically can be of any length. $\endgroup$ – SamG101 Jan 25 '20 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.