cipher

package
v0.0.0-...-0e440ce Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Overview

Package cipher implments the Noise Protocol Framework cipher function abstract interface and standard cipher functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(cipher Cipher)

Register registers a new cipher for use with `FromString()`.

Types

type Cipher

type Cipher interface {
	fmt.Stringer

	// New constructs a new keyed `cipher.AEAD` instance, with the provided
	// key.
	New(key []byte) (cipher.AEAD, error)

	// EncodeNonce encodes a Noise nonce to a nonce suitable for use with
	// the `cipher.AEAD` instances created by `Cipher.New`.
	EncodeNonce(nonce uint64) []byte
}

Cipher is an AEAD algorithm factory.

var AESGCM Cipher = &cipherAesGcm{}

AESGCM is the AESGCM cipher functions.

Note: This Cipher implementation is always constant time, even on systems where the Go runtime library's is not.

var ChaChaPoly Cipher = &cipherChaChaPoly{}

ChaChaPoly is the ChaChaPoly cipher functions.

var DeoxysII Cipher = &cipherDeoxysII{}

DeoxysII is the DeoxysII cipher functions.

Warning: This cipher is non-standard.

func FromString

func FromString(s string) Cipher

FromString returns a Cipher by algorithm name, or nil.

type Rekeyable

type Rekeyable interface {
	// Rekey returns a new 32-byte cipher key as a pseudorandom function of `k`.
	Rekey(k []byte) []byte
}

Rekeyable is the interface implemented by Cipher instances that have a `REKEY(k)` function specifically defined.

Jump to

Keyboard shortcuts

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