A Go wrapper of the Winternitz One-Time Signature (WOTS) scheme of the Mochimo cryptocurrency.
To install the package, run:
go get github.com/NickP005/WOTS-Go
Here's a complete example showing all features with detailed explanations:
package main
import (
"fmt"
"crypto/rand"
"github.com/NickP005/WOTS-Go"
)
func main() {
var seed [32]byte
rand.Read(seed[:])
keychain, _ := NewKeychain(seed)
keypair := keychain.Next()
fmt.Printf("Public Key: %x\n", keypair.PublicKey)
fmt.Printf("Private Key: %x\n", keypair.PrivateKey)
var message [32]byte
copy(message[:], []byte("Hello, world!"))
// Initialize message with some value
signature := keypair.Sign(message)
fmt.Println("Signature: ", len(signature))
isValid := keypair.Verify(message, signature)
fmt.Printf("Signature valid: %v\n", isValid)
// Tampering with the signature
signature[0] ^= 0xFF
isValid = keypair.Verify(message, signature)
fmt.Printf("Signature valid after tampering: %v\n", isValid)
}
Join our communities for support and discussions:
- NickP005 Development Server: Technical support and development discussions
- Mochimo Official: General Mochimo blockchain discussions and community