package main import ( "crypto/rand" "fmt" "golang.org/x/crypto/chacha20poly1305" ) func main() { // Generate or use a pre-shared key (in real code, this should be properly managed) key := make([]byte, chacha20poly1305.KeySize) if _, err := rand.Read(key); err != nil { // handle error return } fmt.Printf("%x", key) }