tiny_captcha

Crates.iotiny_captcha
lib.rstiny_captcha
version0.1.4
sourcesrc
created_at2022-06-24 11:53:30.237228
updated_at2022-06-24 11:59:30.289816
descriptionrust version tiny captcha
homepage
repositoryhttps://github.com/rmw-link/tiny_captcha
max_upload_size
id612359
size147,410
gcxfd (gcxfd)

documentation

README

tiny_captcha : rust 轻量级验证码生成器,可以编译成 wasm

→ 中文说明

tiny_captcha : rust lightweight captcha generator that compiles to wasm

Project documentation

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 :

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) 代码计划。

人民网络

Commit count: 13

cargo fmt