chacha20prng

package
v8.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: ISC Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const SeedSize = 32

SeedSize is the required length of seeds for New.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

Reader is a ChaCha20 PRNG for a DC-net run. It implements io.Reader.

func New

func New(seed []byte, run uint32) *Reader

New creates a ChaCha20 PRNG seeded by a 32-byte key and a run iteration. The returned reader is not safe for concurrent access. This will panic if the length of seed is not SeedSize bytes.

func (*Reader) Next

func (r *Reader) Next(n int) []byte

Next returns the next n bytes from the reader.

func (*Reader) Read

func (r *Reader) Read(b []byte) (int, error)

Read implements io.Reader.

Jump to

Keyboard shortcuts

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