Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pmuens/time-lock-puzzle

Time-Lock Puzzle schemes implemented in Go and compiled to WebAssembly
https://github.com/pmuens/time-lock-puzzle

cryptography encryption homomorphic-encryption homomorphic-time-lock-puzzle time-lock time-lock-puzzle

Last synced: 20 days ago
JSON representation

Time-Lock Puzzle schemes implemented in Go and compiled to WebAssembly

Awesome Lists containing this project

README

        

# [Time-Lock Puzzle](https://pmuens.github.io/time-lock-puzzle)

Time-Lock Puzzles allow one to hide a message in a cryptographic puzzle that can only be solved after performing an operation $x$ times. The operation is constructed in a way such that a parallel execution is impossible which ensures that the puzzle's difficulty can be reliably determined using current advancements in hardware as a baseline.

The repository includes two Time-Lock Puzzle implementations.

The [first implementation](https://pmuens.github.io/time-lock-puzzle/tlp.html) is the Time-Lock Puzzle construction which was introduced by Rivest et al. in "[Time-Lock Puzzles and Timed-Release Crypto](https://people.eecs.berkeley.edu/~daw/papers/timelock.pdf)". Using this scheme, one can hide a message in a puzzle which is recoverable after time $t$.

The [second implementation](https://pmuens.github.io/time-lock-puzzle/lhtlp.html) is the Linearly Homomorphic Time Lock Puzzle construction that was introduced by Malavolta et al. in "[Homomorphic Time-Lock Puzzles and Applications](https://eprint.iacr.org/2019/635.pdf)". This scheme is special in that it allows for the combination of multiple puzzles into one puzzle which, once solved, reveals the sum of the individual puzzles that were combined.

Note that the code was written for educational purposes only. The project **wasn't audited** and shouldn't be used in production.

## Setup

1. `git clone `
2. `cd `
3. `go run ./cmd/tlp`
4. `go test ./...`
5. `GOOS=js GOARCH=wasm go build -o ./frontend/src/assets/main.wasm cmd/wasm/main.go`
6. `cd frontend`
7. `npm install`
8. `npm run dev`
9. [http://localhost:5173](http://localhost:5173)

## Useful Commands

```sh
go run

go build []

go test [][/...] [-v] [-parellel ]
go test -bench=. [] [-count ] [-benchmem] [-benchtime 2s] [-memprofile ]
go test -cover []
go test -race [] [-count ]
go test -shuffle on []
go test -cover
go test -coverprofile []
go test -run FuncName/RunName

go tool cover -html
go tool cover -func

go tool pprof -list

go fmt []

go vet []

go clean []

go help

go mod init []
go mod tidy
go mod vendor
go mod download

go work init [ [] [...]]
go work use [ [] [...]]
go work sync

# Adjust dependencies in `go.mod`.
go get [@]
go get @none

# Build and install commands.
go install [@]

go list -m [all]

# Has to be run only once.
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./frontend/src/assets

# Run from project's root directory.
GOOS=js GOARCH=wasm go build -o ./frontend/src/assets/main.wasm cmd/wasm/main.go
```

## Useful Resources

### Go

- [Go - Learn](https://go.dev/learn)
- [Go - Documentation](https://go.dev/doc)
- [Go - A Tour of Go](https://go.dev/tour)
- [Go - Effective Go](https://go.dev/doc/effective_go)
- [Go - Playground](https://go.dev/play)
- [Go by Example](https://gobyexample.com)