3 releases
Uses new Rust 2024
| 0.2.2 | Aug 20, 2025 |
|---|---|
| 0.2.1 | Aug 20, 2025 |
| 0.2.0 | Aug 20, 2025 |
#41 in Network programming
9KB
107 lines
PoW Captcha Core
pow-captcha-core is a simple, lightweight, and dependency-free Proof-of-Work (PoW) CAPTCHA library for Rust. It provides the core logic for generating and verifying PoW challenges.
Features
- Generate PoW challenges with a specified difficulty.
- Verify solutions provided by clients.
- Solve challenges (intended for client-side use).
- Supports SHA-256 and SHA-512 hashing algorithms.
Usage
Add the dependency:
cargo add pow-captcha-core
Example
use pow_captcha_core::{generate_challenge, solve_challenge, verify_solution, HashAlgorithm};
// 1. Server: Generate a challenge
let challenge = generate_challenge(Some(4), Some(HashAlgorithm::Sha256));
// 2. Client: Solve the challenge
let solution = solve_challenge(&challenge);
// 3. Server: Verify the solution
assert!(verify_solution(&challenge, &solution));
License
This project is licensed to you under the MIT License.
RoadMap
- Explore the possibility of adding RandomX algorithm support for stronger anti-ASIC properties
Dependencies
~1MB
~25K SLoC