aes

package
v4.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package aes implements AES encryption (formerly Rijndael), as defined in U.S. Federal Information Processing Standards Publication 197.

The AES operations in this package are not implemented using constant-time algorithms. An exception is when running on systems with enabled hardware support for AES that makes these operations constant-time. Examples include amd64 systems using AES-NI extensions and s390x systems using Message-Security-Assist extensions. On such systems, when the result of NewCipher is passed to cipher.NewGCM, the GHASH operation used by GCM is also constant-time.

Index

Constants

View Source
const HasHardAESImplementation = true

Variables

View Source
var SupportsHardAESImplementation = cpu.X86.HasAES

Functions

This section is empty.

Types

type AES

type AES interface {

	// HashAes1Rx4
	//
	// Calculate a 512-bit hash of 'input' using 4 lanes of AES.
	// The input is treated as a set of round keys for the encryption
	// of the initial state.
	//
	// 'input' size must be a multiple of 64.
	//
	// For a 2 MiB input, this has the same security as 32768-round
	// AES encryption.
	//
	// Hashing throughput: >20 GiB/s per CPU core with hardware AES
	HashAes1Rx4(input []byte, output *[64]byte)

	// FillAes1Rx4
	//
	// Fill 'output' with pseudorandom data based on 512-bit 'state'.
	// The state is encrypted using a single AES round per 16 bytes of output
	// in 4 lanes.
	//
	// 'output' size must be a multiple of 64.
	//
	// The modified state is written back to 'state' to allow multiple
	// calls to this function.
	FillAes1Rx4(state *[64]byte, output []byte)

	MergeAes4Rx4(state *[64]byte, key *[64]byte)

	// HashAndFillAes1Rx4 Hashes and fills scratchpad and output in one sweep
	HashAndFillAes1Rx4(scratchpad []byte, output *[64]byte, fillState *[64]byte)

	// FillAes4Rx4 used to generate final program
	FillAes4Rx4(state *[64]byte, output []byte)
}

type HardAES added in v4.6.1

type HardAES struct {
}

func NewHardAES

func NewHardAES() *HardAES

func (HardAES) FillAes1Rx4 added in v4.6.1

func (aes HardAES) FillAes1Rx4(state *[64]byte, output []byte)

func (HardAES) FillAes4Rx4 added in v4.6.1

func (aes HardAES) FillAes4Rx4(state *[64]byte, output []byte)

func (HardAES) HashAes1Rx4 added in v4.6.1

func (aes HardAES) HashAes1Rx4(input []byte, output *[64]byte)

func (HardAES) HashAndFillAes1Rx4 added in v4.6.1

func (aes HardAES) HashAndFillAes1Rx4(scratchpad []byte, output *[64]byte, fillState *[64]byte)

func (HardAES) MergeAes4Rx4 added in v4.6.1

func (aes HardAES) MergeAes4Rx4(state *[64]byte, key *[64]byte)

type SoftAES added in v4.6.1

type SoftAES struct {
}

func NewSoftAES

func NewSoftAES() SoftAES

func (SoftAES) FillAes1Rx4 added in v4.6.1

func (aes SoftAES) FillAes1Rx4(state *[64]byte, output []byte)

func (SoftAES) FillAes4Rx4 added in v4.6.1

func (aes SoftAES) FillAes4Rx4(state *[64]byte, output []byte)

func (SoftAES) HashAes1Rx4 added in v4.6.1

func (aes SoftAES) HashAes1Rx4(input []byte, output *[64]byte)

func (SoftAES) HashAndFillAes1Rx4 added in v4.6.1

func (aes SoftAES) HashAndFillAes1Rx4(scratchpad []byte, output *[64]byte, fillState *[64]byte)

func (SoftAES) MergeAes4Rx4 added in v4.6.1

func (aes SoftAES) MergeAes4Rx4(state *[64]byte, key *[64]byte)

Jump to

Keyboard shortcuts

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