tiny_captcha : rust lightweight captcha generator that compiles to wasm

Project documentationopen in new window

Lightweight CAPTCHA generator, relying only on rand and gif, can be compiled into wasm.

Based on Ivan Tikhonov's captcha libraryopen in new window, rewritten with c2rustopen in new window code conversion.

The font file is from https://github.com/ITikhonov/captcha/blob/master/font.hopen in new window 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 :

Last Updated:
Contributors: gcxfd