Skip to content

ALTCHA

WP-ImmoMakler supports the privacy-friendly spam protection ALTCHA. It is loaded entirely from your own WordPress server, without any connection to third-party services and without cookies.

ALTCHA gives your visitor’s browser an automated computational task (a so-called proof of work). The browser solves it in the background as soon as the page has loaded, while your visitor fills in the form. All that is visible is a small field confirming that the check succeeded:

The ALTCHA field in the contact form showing the verified confirmation

Your visitors therefore never have to solve a puzzle or click anything. For a spam bot submitting forms en masse, however, the computational effort adds up to a real obstacle.

The server then checks whether the submitted solution belongs to a task it issued itself. Each task is valid only once and only for a limited time.

ALTCHA is enabled by default – there is nothing for you to set up. You’ll find the selection in your website’s backend (wp-admin) under WP-ImmoMakler → Settings → Spam Protection → Level 2: CAPTCHA Providers, in case you’d like to choose a different provider or “No CAPTCHA (Level 1 only)” instead. No further settings and no external account are required – unlike the externally hosted CAPTCHAs, which all require a sitekey and secret key.

The setting applies to all of the plugin’s forms:

  • The computational task is generated and verified by your own server. There is no connection to third-party servers.
  • No cookies are set.
  • No behavioural data about your visitors (mouse movements, keystrokes) is collected.
  • The only thing transmitted is the solution to the computational task — a random numeric value along with a checksum.

The “Protected by ALTCHA” note inside the field is a plain text link to altcha.org. It does not load any content from there.

The browser fetches the computational task through a WordPress REST API endpoint:

GET /wp-json/immomakler/v1/altcha/challenge

The response is deliberately not cacheable (Cache-Control: no-store), because each task is valid only once.

WP-ImmoMakler picks the algorithm based on what your server supports:

  • Argon2id, if the PHP sodium extension is loaded – the case on almost every host. Argon2id is memory-hard: each computation step occupies 64 MB of memory. That’s negligible for your visitor’s browser, but it stops a spam bot from offloading the work to graphics cards, which would otherwise solve thousands of tasks in parallel.
  • PBKDF2/SHA-256 otherwise. It needs no extension and no notable amount of memory, but can be computed significantly faster on graphics cards than in a browser.

Both defaults match ALTCHA’s own recommendation for the respective algorithm:

ParameterArgon2idPBKDF2/SHA-256Description
algorithmARGON2IDPBKDF2/SHA-256Algorithm used for the task
Iterations (cost)15,000Effort per computation step
Memory (memory_cost)65,536 KiB (64 MB)–Memory per computation step
Steps (counter)100–2005,000–10,000Number of steps until the solution is found
Validity30 minutes30 minutesThe task expires afterwards
Reusenot possiblenot possibleEach solved task is good for exactly one submission

On a desktop machine, the task is solved with either algorithm in roughly two to three seconds, on a mid-range smartphone in about ten seconds. Since the computation starts as the page loads, it is finished in practice before the form has been filled in. A bot has to solve the same task anew for every single submission and therefore pays the same computing time per submission.

The Argon2id engine is loaded as a separate file from the plugin directory (vendors/altcha/workers/argon2id.js). If memory is tight on your server so that Argon2id can’t be computed there, WP-ImmoMakler automatically issues the affected task with PBKDF2 instead and notes this in the log.

If you still receive spam with ALTCHA enabled, you can increase the computational effort through a filter. The filter receives the defaults for the algorithm your server uses; the following example doubles the effort for either one. Note that this also increases the waiting time on weak devices.

add_filter( 'immomakler_altcha_challenge_options', function ( $options ) {
$options['counter_min'] *= 2;
$options['counter_max'] *= 2;
return $options;
} );

Raise the steps (counter) rather than the iterations (cost) or the memory (memory_cost): the effort for the browser is the product of the values either way, but the iterations and memory additionally determine how long your server takes to issue and verify each task.

The same filter also lets you set the algorithm. This is necessary if the Argon2id engine can’t be loaded in your setup – for example because an optimisation plugin or a CDN serves the plugin directory’s files from a different domain:

add_filter( 'immomakler_altcha_challenge_options', function ( $options ) {
$options['algorithm'] = 'PBKDF2/SHA-256';
return $options;
} );

If the filter names an algorithm your server doesn’t support, the filter is ignored entirely – its steps would be many times too weak or too slow for the other algorithm.

The spam protection hooks into the contact form validation through the following filter:

// Add your own validation logic
add_filter( 'immomakler_contact_form_errors_in_send', function( $errors ) {
// $errors['my_error'] = true;
return $errors;
} );

The error message shown when the check fails can be customised:

add_filter( 'immomakler_contactform_altcha_validationfailed', function ( $html ) {
return '<div class="alert alert-danger" role="alert">Please try again.</div>';
} );