Skip to main content

Module timelock

Module timelock 

Source
Expand description

Time-lock puzzle payloads using Rivest iterated squaring.

A payload is encrypted with a key that can only be derived by performing T sequential modular squarings. This cannot be parallelised, providing practical (but not absolute) time-locking.

Security note: a well-resourced adversary with faster hardware can solve the puzzle earlier. This scheme provides practical but not cryptographic time-binding.

Functionsยง

create_puzzle
Create a time-lock puzzle for the given payload.
default_squarings_per_sec
Returns the default squarings-per-second calibration constant.
solve_puzzle
Solve a time-lock puzzle by performing sequential squarings and decrypting.
try_solve_puzzle
Non-blocking puzzle check. Returns Ok(Some(payload)) if solvable within a very short time budget, Ok(None) otherwise.