
How a Challenge Works
Step by step: how a challenge is generated, stored, and validated on the server.
- When a form renders, the plugin generates a problem with PHP's
random_int(). - A keyed hash of the answer is stored in the visitor's Joomla session — never the
answer itself, in any form, anywhere — alongside the creation time, expiry time, and a random 128-bit challenge ID.
- The markup carries the sum, a spoken version of the question for screen readers, and the
challenge ID in a hidden field. The answer is never present in the page in any form: not in an attribute, not in a code comment, not in the JavaScript.
- On submit (or on an instant check), the plugin looks the challenge up by its ID,
removes it immediately, and compares a hash of the submitted answer against the stored hash using hash_equals() (a timing-safe comparison).
Because the challenge is removed the instant it's looked at, every outcome — right, wrong, expired, or replayed — leaves the visitor needing a fresh sum. There is no way to reuse a challenge, whether by accident or on purpose.
The hash key combines your site's secret with a random salt generated per session, so a challenge record copied out of one visitor's session cannot be validated in another's.
Answers are normalised before comparison, so a visitor isn't punished for a stray space, a leading +, a leading zero, a thousands separator, full-width or Arabic-Indic digits, or (if enabled) typing "twelve" instead of 12.