add readme

This commit is contained in:
b1ek 2023-08-01 14:30:13 +10:00
parent 53810678f6
commit 8f90784b3e
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 23 additions and 0 deletions

23
README.md Normal file
View File

@ -0,0 +1,23 @@
# POWlib
POWlib is a pure rust library for scrypt-based proof-of-work challenges.
It uses 32-byte long scrypt hash with following parameters: `log_n: 6, r: 64, p: 1`
# Example usage
To load an existing challenge: you may use `powlib::gen::POWChallenge { hash: [a 32-byte long hash], range: POWRange::new(min, max) }`
To generate a challenge, use this: `powlib::gen::POWChallenge::make(POWRange::new(min, max))`
To solve a challenge, use this: `challenge.solve_singlethread()`
Threaded solve method is planned but if you want to implement your own, there is a chunked method for solving: `challenge.chunk_solve(min, max)`
So, the simplest code would look like this:
```rust
use powlib::{self, gen::{POWRange, POWChallenge}};
fn main() {
let challenge = POWChallenge::make(POWRange::new(0, 20480));
println!("{}", challenge.solve_singlethread());
}
```