~bsprague/timelock

Rust implementation of 1996 timelock encryption paper
Assorted updates + tweaks
Initial commit, basic PoC

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~bsprague/timelock
read/write
git@git.sr.ht:~bsprague/timelock

You can also use your local clone with git send-email.

#Timelock

A Rust implementation of the 1996 paper "Time-lock puzzles and timed-release Crypto"

Mostly just a proof-of-concept to try and get it functional.

#Usage

It's pretty barebones as is, but you can use it to make your own timelock puzzles by:

  1. Editing the this is the secret message string to be what you want
  2. Adjusting the value of t to indicate how long it should take to decrypt
  3. cargo run --release encrypt
    • This will produce a puzzle.bin file, containing the relevant parameters
      • n - p * q, product of two randomly chosen primes
      • a - Randomly chosen value to be squared
        • The paper says you can probably choose 2, but this repo chooses it randomly between 2 and n
      • t - Number of squarings
      • c_k - The "ciphertext" of the key material
        • We use AES-GCM-SIV for encryption
        • Paper mentions RC5, which I think is old and maybe broken? probably fine but also not a sensible choice in 2024
      • c_m - Ciphertext of the message
      • nonce - Noce used for encryption

To decrypt the message, run cargo run --release decrypt.

#TODO

  • [ ] Some method of benchmarking your hardware to get baseline "squarings per second"
  • [x] Replace assorted unwrap()s with actual Error returns
    • Was just being lazy with the compiler
  • [x] Generate a random nonce, and store that as part of the puzzle as well
  • [ ] Maybe flags to make this actually usable