Expand description
Asynchronous library and cli to solve proof-of-work challenges generated with the kctf scheme.
use kctf::KctfPow;
let challenge = KctfPow::from_challenge("s.AAU5.AACV7mM375HM8wElUbxsknqD").unwrap();
// Solve one
let solution = challenge.clone().solve();
println!("{}", solution);
assert_eq!(solution, "s.LR15WHZE5YO/8EEY9BF7pdvxiJxwkDi7mdS52bg7eVUdHbAwBVxfahl/qxceccZV2PHkj4wQTQ9Ng837/KD9IWQL4v2GmRyjc5O9MxiAXBtxn7FYjjA2as/17lF2lEtQtABbSEUgxam+sIsdfDJMAUzn4fYsS7vOarXh7iY6ZYknrwt1S8EHyQeYkoTUzkpUIVAuSvl8jExcPzvmuaoM6A==");
// Verify solution
assert_eq!(challenge.verify(&solution), Ok(true));
assert_eq!(challenge.verify("s.invalid"), Ok(false));
// Generate a challenge
let challenge = KctfPow::gen_challenge(50);
println!("{}", challenge.serialize_challenge());
Structs§
Enums§
Functions§
- decode_
solution - Decodes a solution.