10 releases (1 stable)

Uses old Rust 2015

1.0.0 Mar 19, 2025
0.0.9 May 17, 2022
0.0.8 Nov 3, 2020
0.0.7 May 16, 2017

#177 in Web programming

Download history 5114/week @ 2025-01-07 6034/week @ 2025-01-14 4621/week @ 2025-01-21 3650/week @ 2025-01-28 5377/week @ 2025-02-04 4898/week @ 2025-02-11 5209/week @ 2025-02-18 5371/week @ 2025-02-25 5425/week @ 2025-03-04 4227/week @ 2025-03-11 4159/week @ 2025-03-18 3435/week @ 2025-03-25 4072/week @ 2025-04-01 2951/week @ 2025-04-08 4810/week @ 2025-04-15 6019/week @ 2025-04-22

18,213 downloads per month
Used in 12 crates (10 directly)

Custom license

2MB
810 lines

CAPTCHA library written in Rust

Build Status GitHub license GitHub stars dependency 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

~4.5MB
~89K SLoC