mirror of
https://git.numenor-labs.us/dsfx.git
synced 2025-04-29 08:10:34 +00:00
13 lines
262 B
Go
13 lines
262 B
Go
package dcrypto
|
|
|
|
import "crypto/rand"
|
|
|
|
// Challenge generates a random challenge of n bytes.
|
|
func Challenge(n int) []byte {
|
|
challenge := make([]byte, n)
|
|
if _, err := rand.Read(challenge); err != nil || len(challenge) != n {
|
|
return nil
|
|
}
|
|
return challenge
|
|
}
|