package crypto import ( "crypto/rand" "io" ) func NewSalt() [16]byte { salt := [16]byte{} if _, err := io.ReadFull(rand.Reader, salt[:]); err != nil { panic("crypto: failed to read salt: " + err.Error()) } return salt } func NewNonce() [12]byte { nonce := [12]byte{} if _, err := io.ReadFull(rand.Reader, nonce[:]); err != nil { panic("crypto: failed to read nonce: " + err.Error()) } return nonce }