Crate lhtlp

Source
Expand description

§lhtlp - Linearly Homomorphic Time-lock Puzzles (LHTLP) implementation

This crate provides a simple library implementation of LHTLP in pure Rust.

§Setup, generate and solve a puzzle

use lhtlp::LHTLP;
use num_bigint::BigUint;
const TIME_HARDNESS: u64 = 100000000;

let lhtlp = LHTLP::setup(64, BigUint::from(TIME_HARDNESS));
let secret = 42;
let puzzle = lhtlp.generate(secret);
let solution = lhtlp.solve(puzzle);

§Homomorphic evaluation of multiple puzzles

let first = lhtlp.generate(42);
let second = lhtlp.generate(13);
let bundle = lhtlp.evaluate(vec![first, second]);

let solution = lhtlp.solve(bundle);
assert!(BigUint::from(55u32) == solution);

Modules§

num_primes

Structs§

LHTLP
A Linearly Homomorphic Timelock Puzzle.