http://qs321.pair.com?node_id=604282


in reply to howto: Perl CGI, image with random scewed text for account creations

I spent quite a long time looking at the various CAPTCHA schemes that are out there in the wild, and what I didn't like about them was that they discriminated against the blind and particularly those who are both blind and hearing impaired. I'm neither, and none of my clients are, either, but I'm just that kind of a guy. So I developed my own, one that plugs a randomly generated non-word string into a sentence and asks the user to find it and enter it into a text input. So far, in about eight months of using it on my low-volume site, it has worked quite well and no one has complained.

Screen readers, in general, will spell out the garbage strings, making it easy enough for the blind to find them and comply. Those who are both blind and deaf can find the garbage string via their Braille terminals... or so goes the theory, since so far no one who's both blind and deaf has contacted me. This was true even before my CAPTCHA went online, though.

It's an easy enough thing to do. From a predefined list of sentences (which could come out of the fortune program), select a sentence at random and a random point within that sentence in which to plug a garbage string. Generate the garbage string, test that it doesn't exist in a dictionary, and plant it in that random spot. Explain to the user that he's supposed to find that non-word and type it into the text input. Use caching similar to that of Authen::Captcha to keep track of what's been recently served and to whom. Bingo bango bongo, an accessible CAPTCHA.

Nuthin' to it but to do it.