You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
368 B
17 lines
368 B
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)
|
|
}
|
|
|