I want to read random values into a byte array. It works like this:
hash = make([]byte,20)
_, err := rand.Read(hash)
But I want to do something like
var hash [20]byte
_, err := rand.Read(hash)
which results in a
cannot use hash (type [20]byte) as type []byte in argument to "crypto/rand".Read
How can I use a [20]byte with rand.Read?
Aucun commentaire:
Enregistrer un commentaire