[OT] programming question

David Cantrell david at cantrell.org.uk
Wed Apr 25 23:53:20 BST 2007


On Wed, Apr 25, 2007 at 11:26:57PM +0100, Nicholas Clark wrote:

>     <p>What colour should the bikeshed be?</p>
>     <input type="hidden" name="question" value="42">
>     <input type="radio" name="guess" value="5">Brown
>     <input type="radio" name="guess" value="3">Green
>     ...
> 
> fairly quickly gives the game away that the answer with value 1 is always
> correct.
> 
> And I don't really want to maintain state on the server between generating
> the question/answer order, and processing the response.
> 
> So what's the best way to randomly permute the order of the answers, store
> a small amount of state in a hidden field in the form, and reproduce the
> permutation back on the next call to the server, such that it can map back
> to the original answer order, without (too much) information leakage?

md5(correct answer plus sekrit) inna bun^Whidden field

When they submit their answer, compare md5(their answer plus sekrit) to
the one you got back from the hidden field.

-- 
David Cantrell | http://www.cantrell.org.uk/david

Cum catapultae proscriptae erunt tum soli proscript catapultas habebunt


More information about the london.pm mailing list