Crate pow_sha256

source ·
Expand description

MCaptch’s SHA256 based Proof of Work library


  use pow_sha256::{ConfigBuilder, PoW};

  fn main() {
      let config = ConfigBuilder::default()

      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));



  • 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
  • Builder for Config.
  • Proof of Work over concrete type T. T can be any type that implements serde::Serialize.
  • Builder for PoW.


  • Error type for ConfigBuilder
  • Return value of incremental prooving. When proof is ready, IncrementalSolve::Work is returned and when proof is not ready, IncrementalSolve::Intermediate is returned
  • Error type for PoWBuilder