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

  • 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.

Enums