Crates.io | tiny_captcha |
lib.rs | tiny_captcha |
version | 0.1.4 |
source | src |
created_at | 2022-06-24 11:53:30.237228 |
updated_at | 2022-06-24 11:59:30.289816 |
description | rust version tiny captcha |
homepage | |
repository | https://github.com/rmw-link/tiny_captcha |
max_upload_size | |
id | 612359 |
size | 147,410 |
Lightweight CAPTCHA generator, relying only on rand and gif, can be compiled into wasm.
Based on Ivan Tikhonov's captcha library, rewritten with c2rust code conversion.
The font file is from https://github.com/ITikhonov/captcha/blob/master/font.h and is ASCII artwork, make and then use unfont to generate the array.
Use the demo :
use anyhow::Result;
use std::{env::current_exe, fs::File};
use tiny_captcha::gif;
fn main() -> Result<()> {
for i in 1..=10 {
let exe = current_exe()?;
let gif_path = exe.parent().unwrap().join(format!("{}.gif", i));
let word = gif(&mut File::create(&gif_path)?);
println!("{} {}", word, gif_path.display());
}
Ok(())
}
The output is shown :
轻量级验证码生成器,仅依赖于 rand 和 gif ,可以编译成 wasm 。
在 Ivan Tikhonov 的验证码库 的基础上,用 c2rust 转代码后改写。
字体文件来自 https://github.com/ITikhonov/captcha/blob/master/font.h ,是 ASCII 艺术字 , make 之后用 unfont 生成数组。
使用演示 :
use anyhow::Result;
use std::{env::current_exe, fs::File};
use tiny_captcha::gif;
fn main() -> Result<()> {
for i in 1..=10 {
let exe = current_exe()?;
let gif_path = exe.parent().unwrap().join(format!("{}.gif", i));
let word = gif(&mut File::create(&gif_path)?);
println!("{} {}", word, gif_path.display());
}
Ok(())
}
输出展示 :
本项目隶属于 人民网络 (rmw.link) 代码计划。