#CAPTCHA

captcha

Library for generating CAPTCHAs

8 releases

Uses old Rust 2015

0.0.8 Nov 3, 2020
0.0.7 May 16, 2017

#73 in Web programming

Download history 230/week @ 2020-08-07 144/week @ 2020-08-14 73/week @ 2020-08-21 224/week @ 2020-08-28 138/week @ 2020-09-04 155/week @ 2020-09-11 84/week @ 2020-09-18 80/week @ 2020-09-25 111/week @ 2020-10-02 109/week @ 2020-10-09 92/week @ 2020-10-16 123/week @ 2020-10-23 124/week @ 2020-10-30 101/week @ 2020-11-06 101/week @ 2020-11-13 175/week @ 2020-11-20

551 downloads per month

Custom license

2MB
815 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 the following three CAPTCHA images:

  • /tmp/captcha1.png
  • /tmp/captcha2.png
  • /tmp/captcha3.png

The generated images will look like the following three images:

captcha   captcha   captcha

Dependencies

~5.5MB
~83K SLoC