Crates.io | proof-of-history |
lib.rs | proof-of-history |
version | 0.1.0 |
source | src |
created_at | 2023-12-29 09:12:58.787573 |
updated_at | 2023-12-29 09:12:58.787573 |
description | A naive, minimalist, demo implementation of Proof of History. |
homepage | |
repository | https://github.com/mitchmindtree/proof-of-history |
max_upload_size | |
id | 1083119 |
size | 35,959 |
A naive, minimalist, demo implementation of the Proof of History (PoH) concept. It allows for the creation of a continuous, cryptographically verifiable sequence of hashed data (ticks).
The library is generic over the hashing implementation using the RustCrypto
group's Digest
trait, making it easy
to play around with different hashing implementations as the basis for ticks.
The crate provides functions for the following:
Digest
trait from the digest
crate. Supports
associating arbitrary data with each tick.type Hasher = sha2::Sha256;
let seed = <_>::default();
let mut ticks = proof_of_history::ticks::<Hasher>(seed);
for i in 0..10 {
let tick = ticks.next();
println!("Tick {}: {:x}", i, tick);
}
type Hasher = sha2::Sha256;
let seed = <_>::default();
let mut ticks = proof_of_history::ticks::<Hasher>(seed);
let ticks: Vec<_> = std::iter::from_fn(|| Some(ticks.next())).take(2usize.pow(16)).collect();
proof_of_history::verify::<Hasher, _>(&ticks, |_, _| <_>::default()).unwrap();
See examples/demo.rs for a demonstration of a tick producer and a verifier running side by side.
Some benches are provided to get an idea of the rate of tick generation per second for different hashing methods, along with an idea of the margin of error. E.g. my M2 Macbook Air produced ~5.5M sha256 ticks per second, and verified ~30.7M ticks per second.