9 个版本
使用旧 Rust 2015
0.0.9 | 2022年5月17日 |
---|---|
0.0.8 | 2020年11月3日 |
0.0.7 | 2017年5月16日 |
#494 in 网络编程
16,536 每月下载量
用于 9 个 Crates(8 个直接使用)
2MB
809 行
用 Rust 编写的验证码库
用于生成如下验证码的库
要求
Rust (https://rust-lang.net.cn/)
文档
使用
将以下依赖项添加到 Cargo.toml
文件中
[dependencies]
captcha = "*"
在你的源文件中执行
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");
}
运行示例
git clone [email protected]:daniel-e/captcha.git
cd captcha
cargo run --example captcha
此示例在当前目录中创建 12 个验证码图像(PNG 图像)。
生成的图像将类似于以下三幅图像
依赖项
~12MB
~79K SLoC