Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SupportedModes

func SupportedModes() []string

SupportedModes returns the list of supported CryptoModes.

Types

type CryptState

type CryptState struct {
	Key       []byte
	EncryptIV []byte
	DecryptIV []byte

	LastGoodTime int64

	Good         uint32
	Late         uint32
	Lost         uint32
	Resync       uint32
	RemoteGood   uint32
	RemoteLate   uint32
	RemoteLost   uint32
	RemoteResync uint32
	// contains filtered or unexported fields
}

func (*CryptState) Decrypt

func (cs *CryptState) Decrypt(dst, src []byte) error

func (*CryptState) Encrypt

func (cs *CryptState) Encrypt(dst, src []byte)

func (*CryptState) GenerateKey

func (cs *CryptState) GenerateKey(mode string) error

func (*CryptState) Overhead

func (cs *CryptState) Overhead() int

Overhead returns the length, in bytes, that a ciphertext is longer than a plaintext.

func (*CryptState) SetKey

func (cs *CryptState) SetKey(mode string, key []byte, eiv []byte, div []byte) error

type CryptoMode

type CryptoMode interface {
	NonceSize() int
	KeySize() int
	Overhead() int

	SetKey([]byte)
	Encrypt(dst []byte, src []byte, nonce []byte)
	Decrypt(dst []byte, src []byte, nonce []byte) bool
}

Directories

Path Synopsis
ocb2 Package ocb2 implements the version 2 of the OCB authenticated-encryption algorithm.