Expand description
MCaptch’s SHA256 based Proof of Work library
§Example:
use mcaptcha_pow_sha256::{ConfigBuilder, PoW};
fn main() {
let config = ConfigBuilder::default()
.salt("myrandomsaltisnotlongenoug".into())
.build()
.unwrap();
let phrase = "ironmansucks";
const DIFFICULTY: u32 = 1000;
let work = config.prove_work(&phrase, DIFFICULTY).unwrap();
assert!(config.is_valid_proof(&work, &phrase));
assert!(config.is_sufficient_difficulty(&work, DIFFICULTY));
} Modules§
Structs§
- Config
- Configuration for generting proof of work Please choose a long, unique value for salt Resistance to dictionary/rainbow attacks depend on uniqueness of the salt
- Config
Builder - Builder for
Config. - PoW
- Proof of Work over concrete type T. T can be any type that implements serde::Serialize.
- PoWBuilder
- Builder for
PoW.
Enums§
- Config
Builder Error - Error type for ConfigBuilder
- PoWBuilder
Error - Error type for PoWBuilder