crypto

package
v0.0.0-...-5e9b8e2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EpochSize     = 4
	MessageOffset = EpochSize + 4
)

Variables

This section is empty.

Functions

func Signature

func Signature(value uint32) []byte

func SignatureToUint32

func SignatureToUint32(sig []byte) uint32

Types

type MAC

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

MAC has the ability to encrypt and decrypt (short) messages as long as they share the same key and the same epoch.

func New

func New(key []byte) (*MAC, error)

New builds a new MAC using a 256-bit/32 byte encryption key, a numeric epoch and numeric pseudo-random salt

func (*MAC) Decrypt

func (m *MAC) Decrypt(dst, src []byte) ([]byte, error)

Decrypt decrypts src and appends to dst, returning the resulting byte slice or an error if the input cannot be authenticated.

func (*MAC) Encrypt

func (m *MAC) Encrypt(dst, src []byte) []byte

Encrypt encrypts src and appends to dst, returning the resulting byte slice

func (*MAC) Overhead

func (m *MAC) Overhead() int

Overhead returns the maximum difference between the lengths of a plaintext and its ciphertext.

Jump to

Keyboard shortcuts

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