#generate

captcha

Library for generating CAPTCHAs

9 releases

Uses old Rust 2015

0.0.9 May 17, 2022
0.0.8 Nov 3, 2020
0.0.7 May 16, 2017

#494 in Web programming

Download history 2590/week @ 2024-03-15 2590/week @ 2024-03-22 2747/week @ 2024-03-29 2506/week @ 2024-04-05 2467/week @ 2024-04-12 2635/week @ 2024-04-19 2818/week @ 2024-04-26 2344/week @ 2024-05-03 2841/week @ 2024-05-10 3065/week @ 2024-05-17 3046/week @ 2024-05-24 3116/week @ 2024-05-31 3428/week @ 2024-06-07 5251/week @ 2024-06-14 4586/week @ 2024-06-21 2674/week @ 2024-06-28

16,536 downloads per month
Used in 9 crates (8 directly)

Custom license

2MB
809 lines

CAPTCHA library written in Rust

Build Status

A library to generate CAPTCHAs like these:

captcha   captcha   captcha

Requirements

Rust (https://www.rust-lang.org/)

Documentation

https://docs.rs/captcha

Usage

Add the following dependency to the Cargo.toml file:

[dependencies]
captcha = "*"

In your source file do:

extern crate captcha;

use captcha::Captcha;
use captcha::filters::Noise;
use std::path::Path;

fn main() {
    Captcha::new()
        .add_chars(5)
        .apply_filter(Noise::new(0.1))
        .view(220, 120)
        .save(Path::new("/tmp/captcha.png"))
        .expect("save failed");
}

Running the example

git clone git@github.com:daniel-e/captcha.git
cd captcha
cargo run --example captcha

This example creates 12 CAPTCHA images (PNG images) in the current directory.

The generated images will look like the following three images:

captcha   captcha   captcha

Dependencies

~12MB
~79K SLoC