Lamport signatures are a one-time signature scheme. Each key is intended to be used only once.
Generate key
k, err := lamport.GenerateKey(rand.Reader, crypto.SHA256)
Sign message
message := []byte("Hello, Lamport!")
messageHash := sha256.Sum256(message)
sig, _ := lamport.Sign(k, messageHash[:])
Verify signature
if lamport.Verify(&k.PublicKey, messageHash[:], sig); err != nil {
// signature invalid here
}
To test on your machine use:
go test
If you want to run the benchmarks:
go test -bench=.
Documentation can be found here.