xchacha20

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CipherID = "xc20"
	MACID    = "p1305"
)

Variables

This section is empty.

Functions

func ParsePoly1305Tag

func ParsePoly1305Tag(tagstr string) ([]byte, error)

ParsePoly1305Tag loads a poly1305 tag from string

func Register

func Register(algs h2streamcipher.Algs)

Register registers a cipher alg

Types

type Config

type Config struct {
	Key   []byte
	Nonce []byte
}

Config are xchacha20 params

func NewConfig

func NewConfig() (*Config, error)

NewConfig creates a new xchacha20 config

func ParseConfig

func ParseConfig(params string) (*Config, error)

ParseConfig loads a xchacha20 config from params string

func (Config) String

func (c Config) String() string

String returns a xchacha20 config as a string

type Poly1305Auth

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

Poly1305Auth computes a poly1305 auth tag

func NewFromConfig

func NewFromConfig(config Config) (h2streamcipher.KeyStream, *Poly1305Auth, error)

NewFromConfig creates a xchacha20-poly1305 cipher from config

func NewFromParams

func NewFromParams(params string) (h2streamcipher.KeyStream, *Poly1305Auth, error)

NewFromParams creates a xchacha20-poly1305 cipher from params

func (*Poly1305Auth) Close

func (a *Poly1305Auth) Close() error

Close writes the number of bytes of the input to the hash and should be called after writing all the input. This prevents length extension attacks.

func (*Poly1305Auth) Tag

func (a *Poly1305Auth) Tag() string

Tag returns an auth tag

func (*Poly1305Auth) Verify

func (a *Poly1305Auth) Verify(tagstr string) (bool, error)

Verify authenticates ciphertext with an auth tag

func (*Poly1305Auth) Write

func (a *Poly1305Auth) Write(src []byte) (int, error)

Write implements io.Writer

Jump to

Keyboard shortcuts

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