4 个版本
0.1.4 | 2022年6月24日 |
---|---|
0.1.3 | 2022年6月24日 |
0.1.2 | 2022年6月24日 |
0.1.1 | 2022年6月24日 |
#536 in WebAssembly
93KB
1.5K SLoC
tiny_captcha : rust 轻量级验证码生成器,可以编译成 wasm
tiny_captcha : rust lightweight captcha generator that compiles to wasm
轻量级验证码生成器,仅依赖于 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(())
}
输出展示
tiny_captcha : rust 轻量级验证码生成器,可以编译成 wasm
轻量级验证码生成器,仅依赖于 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) 代码计划。
依赖
~0.5–1MB
~16K SLoC