mirror of
https://codeberg.org/cunicu/cunicu.git
synced 2025-12-24 06:18:40 +08:00
16 lines
272 B
Go
16 lines
272 B
Go
// Package crypto implements basic crypto primitives used in the project
|
|
package crypto
|
|
|
|
import "crypto/rand"
|
|
|
|
func GetNonce(len int) (Nonce, error) {
|
|
var nonce = make(Nonce, len)
|
|
|
|
_, err := rand.Read(nonce)
|
|
if err != nil {
|
|
return nonce, err
|
|
}
|
|
|
|
return nonce, nil
|
|
}
|