10 releases (1 stable)

Uses old Rust 2015

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

#140 in Web programming

Download history 5840/week @ 2024-12-01 5025/week @ 2024-12-08 3923/week @ 2024-12-15 1032/week @ 2024-12-22 1542/week @ 2024-12-29 4581/week @ 2025-01-05 6716/week @ 2025-01-12 4184/week @ 2025-01-19 3925/week @ 2025-01-26 4736/week @ 2025-02-02 5481/week @ 2025-02-09 4995/week @ 2025-02-16 5300/week @ 2025-02-23 5316/week @ 2025-03-02 4689/week @ 2025-03-09 3750/week @ 2025-03-16

19,366 downloads per month
Used in 11 crates (9 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

~5.5MB
~97K SLoC