Skip to content

Generate verification images dynamically

License

Notifications You must be signed in to change notification settings

0xS4D/captcha-rs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

captcha-rs

Captcha-rs crate test issues Downloads MIT License Captcha-rs documentation dependency status

captcha-rs is a library that generate verification images dynamically.

Example pictures are as follows:

img-light-1.png img-light-2.png img-light-3.png
img-dark-1.png img-dark-2.png img-dark-3.png

Using complexity method

Complexity Dark Mode / Noise Filter Light Mode / Noise Filter
Level 1 img-dark img-light
Level 2 img-dark img-light
Level 3 img-dark img-light
Level 4 img-dark img-light
Level 5 img-dark img-light
Level 6 img-dark img-light
Level 7 img-dark img-light
Level 8 img-dark img-light
Level 9 img-dark img-light
Level 10 img-dark img-light

Example

Add the following dependency to the Cargo.toml file:

[dependencies]
captcha-rs = "0.2.6"

And then get started in your main.rs:

use captcha_rs::CaptchaBuilder;

fn main() {
	
	let captcha = CaptchaBuilder::new()
		.length(5)
		.width(130)
		.height(40)
		.dark_mode(false)
		.complexity(1) // min: 1, max: 10
		.build();
	
	println!("text: {}", captcha.text);
	println!("base_img: {}", captcha.to_base64());
	
}

Run

# Dev
💲 cargo run

# Build
💲 cargo build

# Test
💲 cargo test -- --nocapture

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in captcha-rs by you, shall be licensed as MIT, without any additional terms or conditions.

About

Generate verification images dynamically

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%