stream

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESCTRNonceSize added in v1.0.1

func AESCTRNonceSize() int

AESCTRNonceSize returns the AES-CTR nonce size in bytes.

func ChaCha20KeySize

func ChaCha20KeySize() int

ChaCha20KeySize returns the ChaCha20 key size in bytes.

func ChaCha20NonceSize

func ChaCha20NonceSize() int

ChaCha20NonceSize returns the ChaCha20 nonce size in bytes.

func XChaCha20KeySize

func XChaCha20KeySize() int

XChaCha20KeySize returns the XChaCha20 key size in bytes.

func XChaCha20NonceSize

func XChaCha20NonceSize() int

XChaCha20NonceSize returns the XChaCha20 nonce size in bytes.

Types

type Stream

type Stream interface {
	// KeyStream writes len(dst) keystream bytes into dst.
	KeyStream(dst []byte)
	// XORKeyStream XORs the keystream with src, writing the result to dst.
	// The src and dst slices may overlap.
	XORKeyStream(dst, src []byte)
	// Reset rewinds the stream to the supplied block counter.
	Reset(counter uint32)
}

Stream represents a synchronous stream cipher that can either generate raw keystream bytes or XOR them with input in place.

func NewAESCTR added in v1.0.1

func NewAESCTR(key, nonce []byte, counter uint32) (Stream, error)

NewAESCTR returns an AES-CTR stream cipher implementing Stream.

func NewChaCha20

func NewChaCha20(key, nonce []byte, counter uint32) (Stream, error)

NewChaCha20 returns a ChaCha20 stream cipher implementing Stream.

func NewXChaCha20

func NewXChaCha20(key, nonce []byte, counter uint32) (Stream, error)

NewXChaCha20 returns an XChaCha20 stream cipher implementing Stream.

Jump to

Keyboard shortcuts

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