From 441f50637d0f54091ea783f1a48b47c8cb562b65 Mon Sep 17 00:00:00 2001 From: Robert Kornacki <11645932+robkorn@users.noreply.github.com> Date: Wed, 24 Jul 2019 11:24:39 -0400 Subject: [PATCH] Updated readme to reflect new added fn --- Cargo.toml | 2 +- readme.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8c3d3b9..a6c7491 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["PoW", "sha256", "proof-of-work"] readme = "readme.md" license = "MIT OR Apache-2.0" repository = "https://github.com/robkorn/pow" -categories = ["pow", "sha256"] +categories = ["algorithms"] [dependencies] sha2 = "0.8.0" serde = { version = "1.0.97", features = ["derive"] } diff --git a/readme.md b/readme.md index 2394df2..6272e99 100644 --- a/readme.md +++ b/readme.md @@ -25,7 +25,7 @@ let phrase = b"Phrase to be used.".to_vec(); let pw = PoW::prove_work(&phrase, difficulty).unwrap(); // Asserting that the result is of sufficient difficulty -assert!(pw.result >= difficulty); +assert!(pw.is_sufficient_difficulty(difficulty)); // Asserting that the PoW was generated from the provided phrase assert!(pw.is_valid_proof(&phrase)) @@ -40,6 +40,7 @@ let difficulty = u128::max_value() - u128::max_value() / 100_000; let now: u64 = get_unix_time_seconds(); let pw = PoW::prove_work(&now, difficulty).unwrap(); +// Alternative way to check that the result is of sufficient difficulty assert!(pw.result >= difficulty); assert!(pw.is_valid_proof(&phrase)) ```