captcha-rs
captcha-rs is a library that generate verification images dynamically.
Example pictures are as follows:
![]() |
![]() |
![]() |
|---|---|---|
![]() |
![]() |
![]() |
Using complexity method
| Complexity | Light Mode / Noise Filter | Dark Mode / Noise Filter |
|---|---|---|
| Level 1 | ![]() |
![]() |
| Level 2 | ![]() |
![]() |
| Level 3 | ![]() |
![]() |
| Level 4 | ![]() |
![]() |
| Level 5 | ![]() |
![]() |
| Level 6 | ![]() |
![]() |
| Level 7 | ![]() |
![]() |
| Level 8 | ![]() |
![]() |
| Level 9 | ![]() |
![]() |
| Level 10 | ![]() |
![]() |
Using Visual Enhancements and Bot Deterrence
| Effect | Image example |
|---|---|
| Drop Shadow | ![]() |
| Heavy Interference | ![]() |
| Mild Distortion | ![]() |
| Heavy Distortion | ![]() |
Example
Add the following dependency to the Cargo.toml file:
[]
= "0.4.0"
And then get started in your main.rs:
use CaptchaBuilder;
Run
# Dev
# Build
# Test
Performance
The library is highly optimized for fast image generation. The table below represents benchmarks tested with varying configurations (measured per image):
| Configuration | Time per Image | Core Settings |
|---|---|---|
| Default | ~53 µs |
length=5, 130x40 |
| High Complexity | ~439 µs |
length=5, 200x70, complexity=10 |
| High Distortion | ~160 µs |
length=5, 200x70, distortion=15 |
| Extreme Security | ~1.16 ms |
length=8, 300x100, complexity=10, distortion=20, drop_shadow, high interference |
Note: Benchmarks run on a single thread using cargo bench. Performance will vary based on hardware, but standard generation should easily exceed thousands of images per second.
License
This project is licensed under the MIT license.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in captcha-rs by you, shall be licensed as MIT, without any additional terms or conditions.






























