MCPcopy Index your code
hub / github.com/dnote/dnote / getRandomBytes

Function getRandomBytes

pkg/server/crypt/crypt.go:27–34  ·  view source on GitHub ↗

getRandomBytes generates a cryptographically secure pseudorandom numbers of the given size in byte

(numBytes int)

Source from the content-addressed store, hash-verified

25// getRandomBytes generates a cryptographically secure pseudorandom numbers of the
26// given size in byte
27func getRandomBytes(numBytes int) ([]byte, error) {
28 b := make([]byte, numBytes)
29 if _, err := rand.Read(b); err != nil {
30 return nil, errors.Wrap(err, "reading random bits")
31 }
32
33 return b, nil
34}
35
36// GetRandomStr generates a cryptographically secure pseudorandom numbers of the
37// given size in byte

Callers 1

GetRandomStrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected