ascon

package
v1.0.3002 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NonceSize = 128 / 8
	KeySize   = 128 / 8
	TagSize   = 128 / 8
)
View Source
const BlockSize = 64 / 8 // bytes
View Source
const HashSize = 256 / 8 // bytes

Variables

This section is empty.

Functions

This section is empty.

Types

type AEAD

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

AEAD provides an implementation of Ascon-128. It implements the crypto/cipher.AEAD interface.

func NewAEAD

func NewAEAD(key []byte) (*AEAD, error)

func (*AEAD) NonceSize

func (a *AEAD) NonceSize() int

func (*AEAD) Open

func (a *AEAD) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error)

func (*AEAD) Overhead

func (a *AEAD) Overhead() int

func (*AEAD) Seal

func (a *AEAD) Seal(dst, nonce, plaintext, additionalData []byte) []byte

Seal encrypts and authenticates a plaintext and appends ciphertext to dst, returning the appended slice.

func (*AEAD) SetKey

func (a *AEAD) SetKey(key []byte)

Sets the key to a new value. This method is not safe for concurrent use with other methods.

type Hash

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

func NewHash

func NewHash() *Hash

func NewHasha

func NewHasha() *Hash

func (*Hash) BlockSize

func (d *Hash) BlockSize() int

The data rate of the sponge, in bytes. Writes which are a multiple of BlockSize will be more performant.

func (*Hash) Clone

func (h *Hash) Clone() *Hash

Clone returns a new copy of h.

func (*Hash) Reset

func (h *Hash) Reset()

func (*Hash) Size

func (h *Hash) Size() int

The size of the final hash, in bytes.

func (*Hash) Sum

func (h *Hash) Sum(b []byte) []byte

Sum appends a message digest to [b] and returns the new slice. Does not modify the hash state.

func (*Hash) Write

func (h *Hash) Write(p []byte) (int, error)

type MAC

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

func NewMAC

func NewMAC(key []byte) *MAC

func (*MAC) BlockSize

func (d *MAC) BlockSize() int

func (*MAC) Clone

func (d *MAC) Clone() *MAC

Clone returns a new copy of d.

func (*MAC) Size

func (d *MAC) Size() int

func (*MAC) Sum

func (d0 *MAC) Sum(b []byte) []byte

func (*MAC) Verify

func (d0 *MAC) Verify(mac []byte) (ok bool)

Verify reports whether the MAC of the previously written bytes is equal to the provided MAC. It does not modify the object state.

func (*MAC) Write

func (d *MAC) Write(p []byte) (int, error)

type Xof

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

Xof is an implementation of the Ascon-Xof arbitrary-length hash algorithm. It implements the golang.org/x/crypto/sha3.ShakeHash interface (minus Clone).

func NewXof

func NewXof() *Xof

func (*Xof) BlockSize

func (d *Xof) BlockSize() int

The data rate of the sponge, in bytes. Writes which are a multiple of BlockSize will be more performant.

func (*Xof) Clone

func (x *Xof) Clone() *Xof

Clone returns a new copy of x.

func (*Xof) Read

func (x *Xof) Read(p []byte) (int, error)

func (*Xof) Reset

func (x *Xof) Reset()

func (*Xof) Write

func (x *Xof) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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