mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
13
pkg/rnd/bytes.go
Normal file
13
pkg/rnd/bytes.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package rnd
|
||||
|
||||
import "crypto/rand"
|
||||
|
||||
// RandomBytes returns cryptographically secure random bytes.
|
||||
func RandomBytes(n int) ([]byte, error) {
|
||||
b := make([]byte, n)
|
||||
_, err := rand.Read(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
Reference in New Issue
Block a user