[−][src]Crate pow_sha256
MCaptch's SHA256 based Proof of Work library
Example:
use pow_sha256::{ConfigBuilder, PoW}; fn main() { let config = ConfigBuilder::default() .salt("myrandomsaltisnotlongenoug".into()) .build() .unwrap(); let phrase = "ironmansucks"; const DIFFICULTY: u128 = u128::MAX / 32; let work = config.prove_work(&phrase, DIFFICULTY).unwrap(); assert!(config.calculate(&work, &phrase).unwrap() >= DIFFICULTY); assert!(config.is_valid_proof(&work, &phrase)); assert!(config.is_sufficient_difficulty(&work, DIFFICULTY)); }
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 |
ConfigBuilder | Builder for |
PoW | Proof of Work over concrete type T. T can be any type that implements serde::Serialize. |
PoWBuilder | Builder for |