FAQ archive

Quiz #1 - A Text-based CAPTCHA

Summary

The short story is that it's pretty hard to come up with a text based CAPTCHA which is easy to generate, leggible, and hard to crack given enough time to study the underlying db. All of the solutions basically grabbed some strings from a db and randomly composed them with random numbers to generate the question. Parsing these, however big you make the db, is just a question of knowing what to look for.

There was some talk about internazionalizing strings in programs.

The quiz generated an interesting discussion on comp.lang.lisp relating to using format's ~R and ~P operators. I even learned how to format numbers in polish :)

Question

Solutions

Richard Newman

Randomly generates a formula (represented as normal lisp code) consisting of numbers and the four basic arithmetic ops. This tree is eval'd to compute the answer and printed using a normal tree walker.

source, example

Joseph Abrahamson

Based on a DB which contains different ways of asking the user to do some simple math. The strings are then combined with randomly generated numbers to produce the question.

source, example

Stuart Sierra

A cute db based solution. The captcha has various strings for asking the various parts of the question (communicating the initial value, asking the user to add, asking the user to subtract and asking the final value) and combines these randomly.

This particular implementation is limited to one addition or subtraction but it would be trivial to augment it with different, and multiple, operations.

source, example

Pablo Barenbaum

The various possible sentence structures are defined using a nice, declarative, set of macros. Unlike the other solutions this one applies a random obfustication phase after generating the question.

source, example