syncentropy

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SecureSeed

func SecureSeed() ([32]byte, error)

SecureSeed returns 32 bytes of secure random data for use as a ChaCha8 seed.

Types

type SyncEntropy

type SyncEntropy struct {
	// contains filtered or unexported fields
}

SyncEntropy provides a concurrent-safe ChaCha8 random number generator for use as an io.Reader entropy source.

The ChaCha8 Read() function is apparently not concurrent-safe even though the top-level Int and Float functions are.

func NewSyncEntropy

func NewSyncEntropy(seed [32]byte) *SyncEntropy

NewSyncEntropy creates a new SyncEntropy with an internal ChaCha8 generator using the given seed.

func (*SyncEntropy) Read

func (s *SyncEntropy) Read(p []byte) (n int, err error)

Read will read some psuedo random bytes from the internal ChaCha8 generator with a mutex lock to make it concurrent-safe.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL