Documentation
¶
Overview ¶
Package aes provides low-level AES (Advanced Encryption Standard) operations with hardware acceleration support for Intel AES-NI (amd64), ARM Crypto Extensions (arm64), and VAES (Vector AES) for parallel block processing.
This package exposes individual AES round functions, transformations, and key schedules rather than providing a complete block cipher implementation. It is designed for building custom cryptographic constructions that need direct access to AES primitives.
Core Features ¶
Low-level AES Operations:
- SubBytes/InvSubBytes - S-box transformations
- ShiftRows/InvShiftRows - Row permutations
- MixColumns/InvMixColumns - Column mixing in GF(2^8)
- AddRoundKey - XOR with round key
- Round/InvRound - Complete encryption/decryption rounds
Parallel Processing:
- Block2 (32 bytes) - Process 2 AES blocks simultaneously
- Block4 (64 bytes) - Process 4 AES blocks simultaneously
- Hardware acceleration via VAES (Intel) or ARM Crypto Extensions
Areion Permutations:
- Areion256 (32-byte state) - 10-round wide-block permutation
- Areion512 (64-byte state) - 15-round wide-block permutation
- Suitable for hash functions and authenticated encryption
Hardware Acceleration ¶
The package automatically detects and uses available CPU features:
- Intel AES-NI (AESENC/AESDEC instructions)
- ARM Crypto Extensions (AESE/AESD instructions)
- VAES (AVX2 for 2 blocks, AVX512 for 4 blocks in parallel)
Hardware-accelerated functions have the "HW" suffix and automatically fall back to software implementations when hardware support is unavailable.
Round Function Variants ¶
The package provides three variants of round functions to support different cryptographic constructions:
Standard Rounds (e.g., Round, InvRound):
- Key XOR at the end
- Matches Intel AES-NI and FIPS-197 semantics
- Default choice for most applications
KeyFirst Variants (e.g., RoundKeyFirst, InvRoundKeyFirst):
- Key XOR at the beginning
- Matches ARM Crypto instruction semantics
- More efficient on ARM processors
NoKey Variants (e.g., RoundNoKey, InvRoundNoKey):
- No key XOR operation
- Used for permutations and custom constructions
Key Schedules ¶
Key expansion is provided via the KeySchedule type:
- Supports AES-128 (16-byte keys, 10 rounds)
- Supports AES-192 (24-byte keys, 12 rounds)
- Supports AES-256 (32-byte keys, 14 rounds)
Multi-Round Operations ¶
For better performance, multi-round functions combine multiple rounds in a single call, reducing function call overhead and enabling better instruction pipelining:
- Rounds4/7/10/12/14 - Execute N rounds
- RoundsNWithFinal - N-1 full rounds + 1 final round (standard AES)
- Hardware-accelerated variants available (e.g., Rounds10HW)
Example: Basic AES-128 Encryption ¶
package main
import (
"fmt"
"github.com/jedisct1/go-aes"
)
func main() {
// Create a key schedule from a 16-byte key (AES-128)
key := []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}
ks, _ := aes.NewKeySchedule(key)
// Prepare a block for encryption
var block aes.Block
copy(block[:], []byte("hello world!!!!"))
// Encrypt using the high-level helper
aes.EncryptBlockAES128(&block, ks)
fmt.Printf("Encrypted: %x\n", block)
}
Example: Parallel Block Processing ¶
// Process 2 blocks in parallel with VAES acceleration var blocks aes.Block2 copy(blocks[0:16], plaintext1) copy(blocks[16:32], plaintext2) // Create per-block round keys var roundKeys aes.Key2 roundKeys.SetKey(0, ks.GetRoundKey(1)) roundKeys.SetKey(1, ks.GetRoundKey(1)) // Execute one round on both blocks aes.Round2HW(&blocks, &roundKeys)
Example: Areion256 Permutation ¶
var state aes.Areion256 copy(state[:], input) state.Permute() // state now contains the permuted output
Platform Support ¶
The package supports:
- amd64 with AES-NI and VAES (Intel/AMD)
- arm64 with ARM Crypto Extensions
- Pure Go fallback for all platforms
Performance Considerations ¶
For optimal performance:
- Use hardware-accelerated functions (HW suffix) when available
- Use multi-round functions instead of calling single rounds repeatedly
- Use parallel operations (Block2/Block4) when processing multiple blocks
- Check CPU features with the CPU variable to select the best code path
Security Notes ¶
This package provides low-level AES primitives and does NOT implement:
- Authenticated encryption modes (GCM, EAX, etc.)
- Block cipher modes of operation (CBC, CTR, etc.)
- Key derivation or management
- Protection against side-channel attacks beyond hardware instructions
Users are responsible for:
- Implementing appropriate modes of operation
- Managing keys securely
- Using proper nonces and IVs
- Ensuring thread safety when needed
This package is intended for cryptography experts building custom constructions. For standard AES encryption, consider using Go's crypto/aes and crypto/cipher packages instead.
Index ¶
- Constants
- func AddRoundKey(block *Block, roundKey *Block)
- func Areion256DM(input *[32]byte) [32]byte
- func Areion256EM(key *[32]byte, block *[32]byte) [32]byte
- func Areion256EMDecrypt(key *[32]byte, block *[32]byte) [32]byte
- func Areion512DM(input *[64]byte) [32]byte
- func Areion512EM(key *[64]byte, block *[64]byte) [64]byte
- func Areion512EMDecrypt(key *[64]byte, block *[64]byte) [64]byte
- func AreionSoEM256(key *[64]byte, input *[32]byte) [32]byte
- func AreionSoEM512(key *[128]byte, input *[64]byte) [64]byte
- func DeoxysAddRoundTweakey(state *Block, rtk *DeoxysRoundTweakeys, roundNum int, domain byte)
- func DeoxysLFSR2(tk *Block)
- func DeoxysPermuteTK(tk *Block)
- func DeoxysRound(state *Block, rtk *DeoxysRoundTweakeys, roundNum int, domain byte)
- func EncryptBlockAES(block *Block, ks *KeySchedule)
- func EncryptBlockAES128(block *Block, ks *KeySchedule)
- func EncryptBlockAES192(block *Block, ks *KeySchedule)
- func EncryptBlockAES256(block *Block, ks *KeySchedule)
- func EncryptBlocksAES128(blocks []Block, ks *KeySchedule)
- func EncryptBlocksAES192(blocks []Block, ks *KeySchedule)
- func EncryptBlocksAES256(blocks []Block, ks *KeySchedule)
- func FinalRound(block *Block, roundKey *Block)
- func FinalRound2(blocks *Block2, roundKeys *Key2)
- func FinalRound2HW(blocks *Block2, roundKeys *Key2)
- func FinalRound4(blocks *Block4, roundKeys *Key4)
- func FinalRound4HW(blocks *Block4, roundKeys *Key4)
- func FinalRoundHW(block *Block, roundKey *Block)
- func FinalRoundKeyFirst(block *Block, roundKey *Block)
- func FinalRoundKeyFirst2(blocks *Block2, roundKeys *Key2)
- func FinalRoundKeyFirst2HW(blocks *Block2, roundKeys *Key2)
- func FinalRoundKeyFirst4(blocks *Block4, roundKeys *Key4)
- func FinalRoundKeyFirst4HW(blocks *Block4, roundKeys *Key4)
- func FinalRoundKeyFirstHW(block *Block, roundKey *Block)
- func FinalRoundNoKey(block *Block)
- func FinalRoundNoKey2(blocks *Block2)
- func FinalRoundNoKey2HW(blocks *Block2)
- func FinalRoundNoKey4(blocks *Block4)
- func FinalRoundNoKey4HW(blocks *Block4)
- func FinalRoundNoKeyHW(block *Block)
- func Haraka256(input *[32]byte) [32]byte
- func Haraka256HW(input *[32]byte) [32]byte
- func Haraka512(input *[64]byte) [32]byte
- func Haraka512HW(input *[64]byte) [32]byte
- func InvFinalRound(block *Block, roundKey *Block)
- func InvFinalRound2(blocks *Block2, roundKeys *Key2)
- func InvFinalRound2HW(blocks *Block2, roundKeys *Key2)
- func InvFinalRound4(blocks *Block4, roundKeys *Key4)
- func InvFinalRound4HW(blocks *Block4, roundKeys *Key4)
- func InvFinalRoundHW(block *Block, roundKey *Block)
- func InvFinalRoundKeyFirst(block *Block, roundKey *Block)
- func InvFinalRoundKeyFirst2(blocks *Block2, roundKeys *Key2)
- func InvFinalRoundKeyFirst2HW(blocks *Block2, roundKeys *Key2)
- func InvFinalRoundKeyFirst4(blocks *Block4, roundKeys *Key4)
- func InvFinalRoundKeyFirst4HW(blocks *Block4, roundKeys *Key4)
- func InvFinalRoundKeyFirstHW(block *Block, roundKey *Block)
- func InvFinalRoundNoKey(block *Block)
- func InvFinalRoundNoKey2(blocks *Block2)
- func InvFinalRoundNoKey2HW(blocks *Block2)
- func InvFinalRoundNoKey4(blocks *Block4)
- func InvFinalRoundNoKey4HW(blocks *Block4)
- func InvFinalRoundNoKeyHW(block *Block)
- func InvMixColumns(block *Block)
- func InvMixColumns2HW(blocks *Block2)
- func InvMixColumns4HW(blocks *Block4)
- func InvMixColumnsHW(block *Block)
- func InvRound(block *Block, roundKey *Block)
- func InvRound2(blocks *Block2, roundKeys *Key2)
- func InvRound2HW(blocks *Block2, roundKeys *Key2)
- func InvRound4(blocks *Block4, roundKeys *Key4)
- func InvRound4HW(blocks *Block4, roundKeys *Key4)
- func InvRoundHW(block *Block, roundKey *Block)
- func InvRoundKeyFirst(block *Block, roundKey *Block)
- func InvRoundKeyFirst2(blocks *Block2, roundKeys *Key2)
- func InvRoundKeyFirst2HW(blocks *Block2, roundKeys *Key2)
- func InvRoundKeyFirst4(blocks *Block4, roundKeys *Key4)
- func InvRoundKeyFirst4HW(blocks *Block4, roundKeys *Key4)
- func InvRoundKeyFirstHW(block *Block, roundKey *Block)
- func InvRoundNoKey(block *Block)
- func InvRoundNoKey2(blocks *Block2)
- func InvRoundNoKey2HW(blocks *Block2)
- func InvRoundNoKey4(blocks *Block4)
- func InvRoundNoKey4HW(blocks *Block4)
- func InvRoundNoKeyHW(block *Block)
- func InvRounds4(block *Block, roundKeys *RoundKeys4)
- func InvRounds4HW(block *Block, roundKeys *RoundKeys4)
- func InvRounds4NoKey(block *Block)
- func InvRounds4NoKeyHW(block *Block)
- func InvRounds4NoKey_2(blocks *Block2)
- func InvRounds4NoKey_2HW(blocks *Block2)
- func InvRounds4NoKey_4(blocks *Block4)
- func InvRounds4NoKey_4HW(blocks *Block4)
- func InvRounds4WithFinal(block *Block, roundKeys *RoundKeys4)
- func InvRounds4WithFinalHW(block *Block, roundKeys *RoundKeys4)
- func InvRounds4_2(blocks *Block2, roundKeys *RoundKeys4)
- func InvRounds4_2HW(blocks *Block2, roundKeys *RoundKeys4)
- func InvRounds4_4(blocks *Block4, roundKeys *RoundKeys4)
- func InvRounds4_4HW(blocks *Block4, roundKeys *RoundKeys4)
- func InvRounds6(block *Block, roundKeys *RoundKeys6)
- func InvRounds6HW(block *Block, roundKeys *RoundKeys6)
- func InvRounds6WithFinal(block *Block, roundKeys *RoundKeys6)
- func InvRounds6WithFinalHW(block *Block, roundKeys *RoundKeys6)
- func InvRounds7(block *Block, roundKeys *RoundKeys7)
- func InvRounds7HW(block *Block, roundKeys *RoundKeys7)
- func InvRounds7NoKey(block *Block)
- func InvRounds7NoKeyHW(block *Block)
- func InvRounds7NoKey_2(blocks *Block2)
- func InvRounds7NoKey_2HW(blocks *Block2)
- func InvRounds7NoKey_4(blocks *Block4)
- func InvRounds7NoKey_4HW(blocks *Block4)
- func InvRounds7WithFinal(block *Block, roundKeys *RoundKeys7)
- func InvRounds7WithFinalHW(block *Block, roundKeys *RoundKeys7)
- func InvRounds7_2(blocks *Block2, roundKeys *RoundKeys7)
- func InvRounds7_2HW(blocks *Block2, roundKeys *RoundKeys7)
- func InvRounds7_4(blocks *Block4, roundKeys *RoundKeys7)
- func InvRounds7_4HW(blocks *Block4, roundKeys *RoundKeys7)
- func InvRounds10(block *Block, roundKeys *RoundKeys10)
- func InvRounds10HW(block *Block, roundKeys *RoundKeys10)
- func InvRounds10NoKey(block *Block)
- func InvRounds10NoKeyHW(block *Block)
- func InvRounds10NoKey_2(blocks *Block2)
- func InvRounds10NoKey_2HW(blocks *Block2)
- func InvRounds10NoKey_4(blocks *Block4)
- func InvRounds10NoKey_4HW(blocks *Block4)
- func InvRounds10WithFinal(block *Block, roundKeys *RoundKeys10)
- func InvRounds10WithFinalHW(block *Block, roundKeys *RoundKeys10)
- func InvRounds10_2(blocks *Block2, roundKeys *RoundKeys10)
- func InvRounds10_2HW(blocks *Block2, roundKeys *RoundKeys10)
- func InvRounds10_4(blocks *Block4, roundKeys *RoundKeys10)
- func InvRounds10_4HW(blocks *Block4, roundKeys *RoundKeys10)
- func InvRounds12(block *Block, roundKeys *RoundKeys12)
- func InvRounds12HW(block *Block, roundKeys *RoundKeys12)
- func InvRounds12NoKey(block *Block)
- func InvRounds12NoKeyHW(block *Block)
- func InvRounds12NoKey_2(blocks *Block2)
- func InvRounds12NoKey_2HW(blocks *Block2)
- func InvRounds12NoKey_4(blocks *Block4)
- func InvRounds12NoKey_4HW(blocks *Block4)
- func InvRounds12WithFinal(block *Block, roundKeys *RoundKeys12)
- func InvRounds12WithFinalHW(block *Block, roundKeys *RoundKeys12)
- func InvRounds12_2(blocks *Block2, roundKeys *RoundKeys12)
- func InvRounds12_2HW(blocks *Block2, roundKeys *RoundKeys12)
- func InvRounds12_4(blocks *Block4, roundKeys *RoundKeys12)
- func InvRounds12_4HW(blocks *Block4, roundKeys *RoundKeys12)
- func InvRounds14(block *Block, roundKeys *RoundKeys14)
- func InvRounds14HW(block *Block, roundKeys *RoundKeys14)
- func InvRounds14NoKey(block *Block)
- func InvRounds14NoKeyHW(block *Block)
- func InvRounds14NoKey_2(blocks *Block2)
- func InvRounds14NoKey_2HW(blocks *Block2)
- func InvRounds14NoKey_4(blocks *Block4)
- func InvRounds14NoKey_4HW(blocks *Block4)
- func InvRounds14WithFinal(block *Block, roundKeys *RoundKeys14)
- func InvRounds14WithFinalHW(block *Block, roundKeys *RoundKeys14)
- func InvRounds14_2(blocks *Block2, roundKeys *RoundKeys14)
- func InvRounds14_2HW(blocks *Block2, roundKeys *RoundKeys14)
- func InvRounds14_4(blocks *Block4, roundKeys *RoundKeys14)
- func InvRounds14_4HW(blocks *Block4, roundKeys *RoundKeys14)
- func InvShiftRows(block *Block)
- func InvSubBytes(block *Block)
- func MixColumns(block *Block)
- func OptimalParallelBlocks() int
- func PadTweak(tweak [8]byte) [16]byte
- func PerBlockRounds4_2(blocks *Block2, keySets *PerBlockRoundKeys4_2)
- func PerBlockRounds4_2HW(blocks *Block2, keySets *PerBlockRoundKeys4_2)
- func PerBlockRounds4_4(blocks *Block4, keySets *PerBlockRoundKeys4_4)
- func PerBlockRounds4_4HW(blocks *Block4, keySets *PerBlockRoundKeys4_4)
- func PerBlockRounds7_2(blocks *Block2, keySets *PerBlockRoundKeys7_2)
- func PerBlockRounds7_2HW(blocks *Block2, keySets *PerBlockRoundKeys7_2)
- func PerBlockRounds7_4(blocks *Block4, keySets *PerBlockRoundKeys7_4)
- func PerBlockRounds7_4HW(blocks *Block4, keySets *PerBlockRoundKeys7_4)
- func PerBlockRounds10WithFinal_2(blocks *Block2, keySets *PerBlockRoundKeys10_2)
- func PerBlockRounds10WithFinal_2HW(blocks *Block2, keySets *PerBlockRoundKeys10_2)
- func PerBlockRounds10WithFinal_4(blocks *Block4, keySets *PerBlockRoundKeys10_4)
- func PerBlockRounds10WithFinal_4HW(blocks *Block4, keySets *PerBlockRoundKeys10_4)
- func PerBlockRounds10_2(blocks *Block2, keySets *PerBlockRoundKeys10_2)
- func PerBlockRounds10_2HW(blocks *Block2, keySets *PerBlockRoundKeys10_2)
- func PerBlockRounds10_4(blocks *Block4, keySets *PerBlockRoundKeys10_4)
- func PerBlockRounds10_4HW(blocks *Block4, keySets *PerBlockRoundKeys10_4)
- func PerBlockRounds12WithFinal_2(blocks *Block2, keySets *PerBlockRoundKeys12_2)
- func PerBlockRounds12WithFinal_2HW(blocks *Block2, keySets *PerBlockRoundKeys12_2)
- func PerBlockRounds12WithFinal_4(blocks *Block4, keySets *PerBlockRoundKeys12_4)
- func PerBlockRounds12WithFinal_4HW(blocks *Block4, keySets *PerBlockRoundKeys12_4)
- func PerBlockRounds12_2(blocks *Block2, keySets *PerBlockRoundKeys12_2)
- func PerBlockRounds12_2HW(blocks *Block2, keySets *PerBlockRoundKeys12_2)
- func PerBlockRounds12_4(blocks *Block4, keySets *PerBlockRoundKeys12_4)
- func PerBlockRounds12_4HW(blocks *Block4, keySets *PerBlockRoundKeys12_4)
- func PerBlockRounds14WithFinal_2(blocks *Block2, keySets *PerBlockRoundKeys14_2)
- func PerBlockRounds14WithFinal_2HW(blocks *Block2, keySets *PerBlockRoundKeys14_2)
- func PerBlockRounds14WithFinal_4(blocks *Block4, keySets *PerBlockRoundKeys14_4)
- func PerBlockRounds14WithFinal_4HW(blocks *Block4, keySets *PerBlockRoundKeys14_4)
- func PerBlockRounds14_2(blocks *Block2, keySets *PerBlockRoundKeys14_2)
- func PerBlockRounds14_2HW(blocks *Block2, keySets *PerBlockRoundKeys14_2)
- func PerBlockRounds14_4(blocks *Block4, keySets *PerBlockRoundKeys14_4)
- func PerBlockRounds14_4HW(blocks *Block4, keySets *PerBlockRoundKeys14_4)
- func Pholkos256Decrypt(block *Pholkos256Block, key *Pholkos256Key, tweak *PholkosTweak)
- func Pholkos256Encrypt(block *Pholkos256Block, key *Pholkos256Key, tweak *PholkosTweak)
- func Pholkos512Decrypt(block *Pholkos512Block, key *Pholkos256Key, tweak *PholkosTweak)
- func Pholkos512Decrypt512(block *Pholkos512Block, key *Pholkos512Key, tweak *PholkosTweak)
- func Pholkos512Encrypt(block *Pholkos512Block, key *Pholkos256Key, tweak *PholkosTweak)
- func Pholkos512Encrypt512(block *Pholkos512Block, key *Pholkos512Key, tweak *PholkosTweak)
- func Round(block *Block, roundKey *Block)
- func Round2(blocks *Block2, roundKeys *Key2)
- func Round2HW(blocks *Block2, roundKeys *Key2)
- func Round4(blocks *Block4, roundKeys *Key4)
- func Round4HW(blocks *Block4, roundKeys *Key4)
- func RoundHW(block *Block, roundKey *Block)
- func RoundKeyFirst(block *Block, roundKey *Block)
- func RoundKeyFirst2(blocks *Block2, roundKeys *Key2)
- func RoundKeyFirst2HW(blocks *Block2, roundKeys *Key2)
- func RoundKeyFirst4(blocks *Block4, roundKeys *Key4)
- func RoundKeyFirst4HW(blocks *Block4, roundKeys *Key4)
- func RoundKeyFirstHW(block *Block, roundKey *Block)
- func RoundNoKey(block *Block)
- func RoundNoKey2(blocks *Block2)
- func RoundNoKey2HW(blocks *Block2)
- func RoundNoKey4(blocks *Block4)
- func RoundNoKey4HW(blocks *Block4)
- func RoundNoKeyHW(block *Block)
- func Rounds4(block *Block, roundKeys *RoundKeys4)
- func Rounds4HW(block *Block, roundKeys *RoundKeys4)
- func Rounds4NoKey(block *Block)
- func Rounds4NoKeyHW(block *Block)
- func Rounds4NoKey_2(blocks *Block2)
- func Rounds4NoKey_2HW(blocks *Block2)
- func Rounds4NoKey_4(blocks *Block4)
- func Rounds4NoKey_4HW(blocks *Block4)
- func Rounds4_2(blocks *Block2, roundKeys *RoundKeys4)
- func Rounds4_2HW(blocks *Block2, roundKeys *RoundKeys4)
- func Rounds4_4(blocks *Block4, roundKeys *RoundKeys4)
- func Rounds4_4HW(blocks *Block4, roundKeys *RoundKeys4)
- func Rounds6(block *Block, roundKeys *RoundKeys6)
- func Rounds6HW(block *Block, roundKeys *RoundKeys6)
- func Rounds6WithFinal(block *Block, roundKeys *RoundKeys6)
- func Rounds6WithFinalHW(block *Block, roundKeys *RoundKeys6)
- func Rounds7(block *Block, roundKeys *RoundKeys7)
- func Rounds7HW(block *Block, roundKeys *RoundKeys7)
- func Rounds7NoKey(block *Block)
- func Rounds7NoKeyHW(block *Block)
- func Rounds7NoKey_2(blocks *Block2)
- func Rounds7NoKey_2HW(blocks *Block2)
- func Rounds7NoKey_4(blocks *Block4)
- func Rounds7NoKey_4HW(blocks *Block4)
- func Rounds7_2(blocks *Block2, roundKeys *RoundKeys7)
- func Rounds7_2HW(blocks *Block2, roundKeys *RoundKeys7)
- func Rounds7_4(blocks *Block4, roundKeys *RoundKeys7)
- func Rounds7_4HW(blocks *Block4, roundKeys *RoundKeys7)
- func Rounds10(block *Block, roundKeys *RoundKeys10)
- func Rounds10HW(block *Block, roundKeys *RoundKeys10)
- func Rounds10NoKey(block *Block)
- func Rounds10NoKeyHW(block *Block)
- func Rounds10NoKey_2(blocks *Block2)
- func Rounds10NoKey_2HW(blocks *Block2)
- func Rounds10NoKey_4(blocks *Block4)
- func Rounds10NoKey_4HW(blocks *Block4)
- func Rounds10WithFinal(block *Block, roundKeys *RoundKeys10)
- func Rounds10WithFinalHW(block *Block, roundKeys *RoundKeys10)
- func Rounds10WithFinal_4(blocks *Block4, roundKeys *RoundKeys10)
- func Rounds10WithFinal_4HW(blocks *Block4, roundKeys *RoundKeys10)
- func Rounds10_2(blocks *Block2, roundKeys *RoundKeys10)
- func Rounds10_2HW(blocks *Block2, roundKeys *RoundKeys10)
- func Rounds10_4(blocks *Block4, roundKeys *RoundKeys10)
- func Rounds10_4HW(blocks *Block4, roundKeys *RoundKeys10)
- func Rounds12(block *Block, roundKeys *RoundKeys12)
- func Rounds12HW(block *Block, roundKeys *RoundKeys12)
- func Rounds12NoKey(block *Block)
- func Rounds12NoKeyHW(block *Block)
- func Rounds12NoKey_2(blocks *Block2)
- func Rounds12NoKey_2HW(blocks *Block2)
- func Rounds12NoKey_4(blocks *Block4)
- func Rounds12NoKey_4HW(blocks *Block4)
- func Rounds12WithFinal(block *Block, roundKeys *RoundKeys12)
- func Rounds12WithFinalHW(block *Block, roundKeys *RoundKeys12)
- func Rounds12WithFinal_4(blocks *Block4, roundKeys *RoundKeys12)
- func Rounds12WithFinal_4HW(blocks *Block4, roundKeys *RoundKeys12)
- func Rounds12_2(blocks *Block2, roundKeys *RoundKeys12)
- func Rounds12_2HW(blocks *Block2, roundKeys *RoundKeys12)
- func Rounds12_4(blocks *Block4, roundKeys *RoundKeys12)
- func Rounds12_4HW(blocks *Block4, roundKeys *RoundKeys12)
- func Rounds14(block *Block, roundKeys *RoundKeys14)
- func Rounds14HW(block *Block, roundKeys *RoundKeys14)
- func Rounds14NoKey(block *Block)
- func Rounds14NoKeyHW(block *Block)
- func Rounds14NoKey_2(blocks *Block2)
- func Rounds14NoKey_2HW(blocks *Block2)
- func Rounds14NoKey_4(blocks *Block4)
- func Rounds14NoKey_4HW(blocks *Block4)
- func Rounds14WithFinal(block *Block, roundKeys *RoundKeys14)
- func Rounds14WithFinalHW(block *Block, roundKeys *RoundKeys14)
- func Rounds14WithFinal_4(blocks *Block4, roundKeys *RoundKeys14)
- func Rounds14WithFinal_4HW(blocks *Block4, roundKeys *RoundKeys14)
- func Rounds14_2(blocks *Block2, roundKeys *RoundKeys14)
- func Rounds14_2HW(blocks *Block2, roundKeys *RoundKeys14)
- func Rounds14_4(blocks *Block4, roundKeys *RoundKeys14)
- func Rounds14_4HW(blocks *Block4, roundKeys *RoundKeys14)
- func ShiftRows(block *Block)
- func SubBytes(block *Block)
- func UseHardwareAcceleration() bool
- func UseVectorAcceleration() bool
- func Vistrutah256Decrypt(ciphertext, plaintext, key []byte, rounds int)
- func Vistrutah256DecryptHW(ciphertext, plaintext, key []byte, rounds int)
- func Vistrutah256Encrypt(plaintext, ciphertext, key []byte, rounds int)
- func Vistrutah256EncryptHW(plaintext, ciphertext, key []byte, rounds int)
- func Vistrutah256MP(input *[32]byte, key []byte, rounds int) [32]byte
- func Vistrutah512Decrypt(ciphertext, plaintext, key []byte, rounds int)
- func Vistrutah512DecryptHW(ciphertext, plaintext, key []byte, rounds int)
- func Vistrutah512Encrypt(plaintext, ciphertext, key []byte, rounds int)
- func Vistrutah512EncryptHW(plaintext, ciphertext, key []byte, rounds int)
- func Vistrutah512MP(input *[64]byte, key []byte, rounds int) [64]byte
- func XorBlock(dst, a, b *Block)
- func XorBlock2(dst, a, b *Block2)
- func XorBlock4(dst, a, b *Block4)
- type AESPRF
- type Areion256
- type Areion512
- type Block
- func DeoxysBC256Decrypt(rk *DeoxysBC256RoundKeys, ciphertext *Block) Block
- func DeoxysBC256DecryptHW(rk *DeoxysBC256RoundKeysHW, ciphertext *Block) Block
- func DeoxysBC256Encrypt(rk *DeoxysBC256RoundKeys, plaintext *Block) Block
- func DeoxysBC256EncryptHW(rk *DeoxysBC256RoundKeys, plaintext *Block) Block
- func DeoxysRoundConstant(domain byte, roundNum int) Block
- func Haraka256ToBlock(input *[32]byte) Block
- func Haraka512ToBlock(input *[64]byte) Block
- type Block2
- type Block4
- type ButterKnifeContext
- type ButterKnifeContextHW
- type ButterKnifeOutput
- type CPUFeatures
- type DeoxysBC256RoundKeys
- type DeoxysBC256RoundKeysHW
- type DeoxysRoundTweakeys
- type Key2
- type Key4
- type KeySchedule
- type KiasuContext
- func (ctx *KiasuContext) KiasuDecrypt(block [16]byte, tweak [8]byte) [16]byte
- func (ctx *KiasuContext) KiasuDecryptHW(block [16]byte, tweak [8]byte) [16]byte
- func (ctx *KiasuContext) KiasuEncrypt(block [16]byte, tweak [8]byte) [16]byte
- func (ctx *KiasuContext) KiasuEncryptHW(block [16]byte, tweak [8]byte) [16]byte
- type PerBlockRoundKeys4_2
- type PerBlockRoundKeys4_4
- type PerBlockRoundKeys7_2
- type PerBlockRoundKeys7_4
- type PerBlockRoundKeys10_2
- type PerBlockRoundKeys10_4
- type PerBlockRoundKeys12_2
- type PerBlockRoundKeys12_4
- type PerBlockRoundKeys14_2
- type PerBlockRoundKeys14_4
- type Pholkos256Block
- type Pholkos256Context
- func (ctx *Pholkos256Context) Decrypt(block *Pholkos256Block)
- func (ctx *Pholkos256Context) DecryptHW(block *Pholkos256Block)
- func (ctx *Pholkos256Context) Encrypt(block *Pholkos256Block)
- func (ctx *Pholkos256Context) EncryptHW(block *Pholkos256Block)
- func (ctx *Pholkos256Context) Retweak(key *Pholkos256Key, tweak *PholkosTweak)
- func (ctx *Pholkos256Context) Schedule(key *Pholkos256Key, tweak *PholkosTweak)
- type Pholkos256Key
- type Pholkos512Block
- type Pholkos512Context
- func (ctx *Pholkos512Context) Decrypt(block *Pholkos512Block)
- func (ctx *Pholkos512Context) DecryptHW(block *Pholkos512Block)
- func (ctx *Pholkos512Context) Encrypt(block *Pholkos512Block)
- func (ctx *Pholkos512Context) EncryptHW(block *Pholkos512Block)
- func (ctx *Pholkos512Context) Schedule256(key *Pholkos256Key, tweak *PholkosTweak)
- func (ctx *Pholkos512Context) Schedule512(key *Pholkos512Key, tweak *PholkosTweak)
- type Pholkos512Key
- type PholkosTweak
- type RoundKeys4
- type RoundKeys6
- type RoundKeys7
- type RoundKeys10
- type RoundKeys12
- type RoundKeys14
- type Tweakey256
Constants ¶
const ( Vistrutah256BlockSize = 32 Vistrutah512BlockSize = 64 RoundsPerStep = 2 Vistrutah256RoundsShort = 10 // 5 steps, for HCTR2/ForkCipher Vistrutah256RoundsLong = 14 // 7 steps, full security Vistrutah512RoundsShort256Key = 10 // 256-bit key, 5 steps Vistrutah512RoundsShort512Key = 12 // 512-bit key, 6 steps Vistrutah512RoundsLong256Key = 14 // 256-bit key, 7 steps Vistrutah512RoundsLong512Key = 18 // 512-bit key, 9 steps )
Variables ¶
This section is empty.
Functions ¶
func AddRoundKey ¶
AddRoundKey XORs the block with the round key.
func Areion256DM ¶ added in v0.1.1
Areion256DM computes the Areion256-DM short fixed-input hash of a 32-byte input. It applies the Davies-Meyer construction: h = P(m) XOR m, returning the full 32-byte result as the digest.
func Areion256EM ¶ added in v0.1.1
Areion256EM encrypts a 32-byte block using the single-key Even-Mansour construction with the Areion256 permutation: E_k(m) = P(m ⊕ k) ⊕ k.
func Areion256EMDecrypt ¶ added in v0.1.1
Areion256EMDecrypt decrypts a 32-byte block using the single-key Even-Mansour construction with the Areion256 inverse permutation: D_k(c) = P^{-1}(c ⊕ k) ⊕ k.
func Areion512DM ¶ added in v0.1.1
Areion512DM computes the Areion512-DM short fixed-input hash of a 64-byte input. It applies the Davies-Meyer construction: h = P(m) XOR m, then extracts 32 bytes from specific positions in the state as the digest.
func Areion512EM ¶ added in v0.1.1
Areion512EM encrypts a 64-byte block using the single-key Even-Mansour construction with the Areion512 permutation: E_k(m) = P(m ⊕ k) ⊕ k.
func Areion512EMDecrypt ¶ added in v0.1.1
Areion512EMDecrypt decrypts a 64-byte block using the single-key Even-Mansour construction with the Areion512 inverse permutation: D_k(c) = P^{-1}(c ⊕ k) ⊕ k.
func AreionSoEM256 ¶ added in v0.1.1
AreionSoEM256 computes a PRF using Sum of Even-Mansour with Areion256. F(k1, k2, m) = P(m XOR k1) XOR P(m XOR k2 XOR d), where d is a domain separation constant and P is the Areion256 permutation. With two independent 32-byte subkeys, this achieves ~170-bit PRF security (beyond birthday bound). Key is 64 bytes (two independent 32-byte subkeys). Input and output are 32 bytes.
func AreionSoEM512 ¶ added in v0.1.1
AreionSoEM512 computes a PRF using Sum of Even-Mansour with Areion512. F(k1, k2, m) = P(m XOR k1) XOR P(m XOR k2 XOR d), where d is a domain separation constant and P is the Areion512 permutation. With two independent 64-byte subkeys, this achieves ~341-bit PRF security (beyond birthday bound). Key is 128 bytes (two independent 64-byte subkeys). Input and output are 64 bytes.
func DeoxysAddRoundTweakey ¶
func DeoxysAddRoundTweakey(state *Block, rtk *DeoxysRoundTweakeys, roundNum int, domain byte)
DeoxysAddRoundTweakey XORs round tweakey and round constant into the state.
func DeoxysLFSR2 ¶
func DeoxysLFSR2(tk *Block)
DeoxysLFSR2 applies the LFSR2 transformation to each byte of a tweakey state. LFSR2: (b7||...||b0) -> (b6||...||b0||b7⊕b5), polynomial x^8 + x^5 + 1
func DeoxysPermuteTK ¶
func DeoxysPermuteTK(tk *Block)
DeoxysPermuteTK applies the h permutation to a tweakey state.
func DeoxysRound ¶
func DeoxysRound(state *Block, rtk *DeoxysRoundTweakeys, roundNum int, domain byte)
DeoxysRound performs one Deoxys round: AddRoundTweakey, SubBytes, ShiftRows, MixColumns.
func EncryptBlockAES ¶
func EncryptBlockAES(block *Block, ks *KeySchedule)
EncryptBlockAES performs AES encryption with automatic key size detection.
func EncryptBlockAES128 ¶
func EncryptBlockAES128(block *Block, ks *KeySchedule)
EncryptBlockAES128 performs complete AES-128 encryption.
func EncryptBlockAES192 ¶
func EncryptBlockAES192(block *Block, ks *KeySchedule)
EncryptBlockAES192 performs complete AES-192 encryption.
func EncryptBlockAES256 ¶
func EncryptBlockAES256(block *Block, ks *KeySchedule)
EncryptBlockAES256 performs complete AES-256 encryption.
func EncryptBlocksAES128 ¶
func EncryptBlocksAES128(blocks []Block, ks *KeySchedule)
EncryptBlocksAES128 encrypts multiple blocks with AES-128.
func EncryptBlocksAES192 ¶
func EncryptBlocksAES192(blocks []Block, ks *KeySchedule)
EncryptBlocksAES192 encrypts multiple blocks with AES-192.
func EncryptBlocksAES256 ¶
func EncryptBlocksAES256(blocks []Block, ks *KeySchedule)
EncryptBlocksAES256 encrypts multiple blocks with AES-256.
func FinalRound ¶
FinalRound performs SubBytes, ShiftRows, AddRoundKey (no MixColumns).
func FinalRound2 ¶
FinalRound2 performs the final AES encryption round on 2 blocks in parallel (software)
func FinalRound2HW ¶
FinalRound2HW performs the final AES encryption round on 2 blocks with hardware acceleration if available
func FinalRound4 ¶
FinalRound4 performs the final AES encryption round on 4 blocks in parallel (software)
func FinalRound4HW ¶
FinalRound4HW performs the final AES encryption round on 4 blocks with hardware acceleration if available
func FinalRoundHW ¶
FinalRoundHW performs the final AES encryption round with hardware acceleration if available
func FinalRoundKeyFirst ¶
FinalRoundKeyFirst performs AddRoundKey, SubBytes, ShiftRows (no MixColumns).
func FinalRoundKeyFirst2 ¶
FinalRoundKeyFirst2 performs the final AES encryption round on 2 blocks in parallel with key XOR first (software)
func FinalRoundKeyFirst2HW ¶
func FinalRoundKeyFirst4 ¶
FinalRoundKeyFirst4 performs the final AES encryption round on 4 blocks in parallel with key XOR first (software)
func FinalRoundKeyFirst4HW ¶
func FinalRoundKeyFirstHW ¶
func FinalRoundNoKey ¶
func FinalRoundNoKey(block *Block)
FinalRoundNoKey performs SubBytes, ShiftRows (no key XOR or MixColumns).
func FinalRoundNoKey2 ¶
func FinalRoundNoKey2(blocks *Block2)
FinalRoundNoKey2 performs the final AES encryption round on 2 blocks in parallel without AddRoundKey (software)
func FinalRoundNoKey2HW ¶
func FinalRoundNoKey2HW(blocks *Block2)
func FinalRoundNoKey4 ¶
func FinalRoundNoKey4(blocks *Block4)
FinalRoundNoKey4 performs the final AES encryption round on 4 blocks in parallel without AddRoundKey (software)
func FinalRoundNoKey4HW ¶
func FinalRoundNoKey4HW(blocks *Block4)
func FinalRoundNoKeyHW ¶
func FinalRoundNoKeyHW(block *Block)
func Haraka256 ¶
Haraka256 computes the Haraka-256 v2 hash of a 32-byte input. Returns a 32-byte hash output.
func Haraka256HW ¶
Haraka256HW computes Haraka-256 with hardware acceleration if available.
func Haraka512 ¶
Haraka512 computes the Haraka-512 v2 hash of a 64-byte input. Returns a 32-byte hash output (truncated).
func Haraka512HW ¶
Haraka512HW computes Haraka-512 with hardware acceleration if available.
func InvFinalRound ¶
InvFinalRound performs InvShiftRows, InvSubBytes, AddRoundKey (no InvMixColumns).
func InvFinalRound2 ¶
InvFinalRound2 performs the final AES decryption round on 2 blocks in parallel (software)
func InvFinalRound2HW ¶
InvFinalRound2HW performs the final AES decryption round on 2 blocks with hardware acceleration if available
func InvFinalRound4 ¶
InvFinalRound4 performs the final AES decryption round on 4 blocks in parallel (software)
func InvFinalRound4HW ¶
InvFinalRound4HW performs the final AES decryption round on 4 blocks with hardware acceleration if available
func InvFinalRoundHW ¶
InvFinalRoundHW performs the final AES decryption round with hardware acceleration if available
func InvFinalRoundKeyFirst ¶
InvFinalRoundKeyFirst performs InvShiftRows, InvSubBytes, AddRoundKey.
func InvFinalRoundKeyFirst2 ¶
InvFinalRoundKeyFirst2 performs the final AES decryption round on 2 blocks in parallel that inverts FinalRoundKeyFirst (software)
func InvFinalRoundKeyFirst4 ¶
InvFinalRoundKeyFirst4 performs the final AES decryption round on 4 blocks in parallel that inverts FinalRoundKeyFirst (software)
func InvFinalRoundKeyFirstHW ¶
func InvFinalRoundNoKey ¶
func InvFinalRoundNoKey(block *Block)
InvFinalRoundNoKey performs InvShiftRows, InvSubBytes.
func InvFinalRoundNoKey2 ¶
func InvFinalRoundNoKey2(blocks *Block2)
InvFinalRoundNoKey2 performs the inverse of FinalRoundNoKey on 2 blocks in parallel without AddRoundKey (software)
func InvFinalRoundNoKey2HW ¶
func InvFinalRoundNoKey2HW(blocks *Block2)
func InvFinalRoundNoKey4 ¶
func InvFinalRoundNoKey4(blocks *Block4)
InvFinalRoundNoKey4 performs the inverse of FinalRoundNoKey on 4 blocks in parallel without AddRoundKey (software)
func InvFinalRoundNoKey4HW ¶
func InvFinalRoundNoKey4HW(blocks *Block4)
func InvFinalRoundNoKeyHW ¶
func InvFinalRoundNoKeyHW(block *Block)
func InvMixColumns2HW ¶
func InvMixColumns2HW(blocks *Block2)
InvMixColumns2HW performs inverse MixColumns on 2 blocks with hardware acceleration if available
func InvMixColumns4HW ¶
func InvMixColumns4HW(blocks *Block4)
InvMixColumns4HW performs inverse MixColumns on 4 blocks with hardware acceleration if available
func InvMixColumnsHW ¶
func InvMixColumnsHW(block *Block)
InvMixColumnsHW performs inverse MixColumns with hardware acceleration if available
func InvRound2HW ¶
InvRound2HW performs one AES decryption round on 2 blocks with hardware acceleration if available
func InvRound4HW ¶
InvRound4HW performs one AES decryption round on 4 blocks with hardware acceleration if available
func InvRoundHW ¶
InvRoundHW performs one AES decryption round with hardware acceleration if available
func InvRoundKeyFirst ¶
InvRoundKeyFirst performs InvMixColumns, InvShiftRows, InvSubBytes, AddRoundKey.
func InvRoundKeyFirst2 ¶
InvRoundKeyFirst2 performs one AES decryption round on 2 blocks in parallel that inverts RoundKeyFirst (software)
func InvRoundKeyFirst2HW ¶
func InvRoundKeyFirst4 ¶
InvRoundKeyFirst4 performs one AES decryption round on 4 blocks in parallel that inverts RoundKeyFirst (software)
func InvRoundKeyFirst4HW ¶
func InvRoundKeyFirstHW ¶
func InvRoundNoKey ¶
func InvRoundNoKey(block *Block)
InvRoundNoKey performs InvMixColumns, InvShiftRows, InvSubBytes.
func InvRoundNoKey2 ¶
func InvRoundNoKey2(blocks *Block2)
InvRoundNoKey2 performs the inverse of RoundNoKey on 2 blocks in parallel without AddRoundKey (software)
func InvRoundNoKey2HW ¶
func InvRoundNoKey2HW(blocks *Block2)
func InvRoundNoKey4 ¶
func InvRoundNoKey4(blocks *Block4)
InvRoundNoKey4 performs the inverse of RoundNoKey on 4 blocks in parallel without AddRoundKey (software)
func InvRoundNoKey4HW ¶
func InvRoundNoKey4HW(blocks *Block4)
func InvRoundNoKeyHW ¶
func InvRoundNoKeyHW(block *Block)
func InvRounds4 ¶
func InvRounds4(block *Block, roundKeys *RoundKeys4)
InvRounds4 performs 4 AES decryption rounds (InvShiftRows, InvSubBytes, InvMixColumns, AddRoundKey)
func InvRounds4HW ¶
func InvRounds4HW(block *Block, roundKeys *RoundKeys4)
func InvRounds4NoKey ¶
func InvRounds4NoKey(block *Block)
InvRounds4NoKey performs 4 AES decryption rounds without AddRoundKey
func InvRounds4NoKeyHW ¶
func InvRounds4NoKeyHW(block *Block)
Falls back to software due to AESDEC operation order mismatch.
func InvRounds4NoKey_2 ¶
func InvRounds4NoKey_2(blocks *Block2)
InvRounds4NoKey_2 performs 4 AES decryption rounds without AddRoundKey on 2 blocks
func InvRounds4NoKey_2HW ¶
func InvRounds4NoKey_2HW(blocks *Block2)
func InvRounds4NoKey_4 ¶
func InvRounds4NoKey_4(blocks *Block4)
InvRounds4NoKey_4 performs 4 AES decryption rounds without AddRoundKey on 4 blocks
func InvRounds4NoKey_4HW ¶
func InvRounds4NoKey_4HW(blocks *Block4)
func InvRounds4WithFinal ¶
func InvRounds4WithFinal(block *Block, roundKeys *RoundKeys4)
InvRounds4WithFinal performs 3 full AES decryption rounds + 1 inverse final round
func InvRounds4WithFinalHW ¶
func InvRounds4WithFinalHW(block *Block, roundKeys *RoundKeys4)
func InvRounds4_2 ¶
func InvRounds4_2(blocks *Block2, roundKeys *RoundKeys4)
InvRounds4_2 performs 4 AES decryption rounds on 2 blocks
func InvRounds4_2HW ¶
func InvRounds4_2HW(blocks *Block2, roundKeys *RoundKeys4)
func InvRounds4_4 ¶
func InvRounds4_4(blocks *Block4, roundKeys *RoundKeys4)
InvRounds4_4 performs 4 AES decryption rounds on 4 blocks
func InvRounds4_4HW ¶
func InvRounds4_4HW(blocks *Block4, roundKeys *RoundKeys4)
func InvRounds6 ¶
func InvRounds6(block *Block, roundKeys *RoundKeys6)
InvRounds6 performs 6 AES decryption rounds
func InvRounds6HW ¶
func InvRounds6HW(block *Block, roundKeys *RoundKeys6)
func InvRounds6WithFinal ¶
func InvRounds6WithFinal(block *Block, roundKeys *RoundKeys6)
InvRounds6WithFinal performs 5 full AES decryption rounds + 1 inverse final round
func InvRounds6WithFinalHW ¶
func InvRounds6WithFinalHW(block *Block, roundKeys *RoundKeys6)
func InvRounds7 ¶
func InvRounds7(block *Block, roundKeys *RoundKeys7)
InvRounds7 performs 7 AES decryption rounds
func InvRounds7HW ¶
func InvRounds7HW(block *Block, roundKeys *RoundKeys7)
func InvRounds7NoKey ¶
func InvRounds7NoKey(block *Block)
InvRounds7NoKey performs 7 AES decryption rounds without AddRoundKey
func InvRounds7NoKeyHW ¶
func InvRounds7NoKeyHW(block *Block)
func InvRounds7NoKey_2 ¶
func InvRounds7NoKey_2(blocks *Block2)
InvRounds7NoKey_2 performs 7 AES decryption rounds without AddRoundKey on 2 blocks
func InvRounds7NoKey_2HW ¶
func InvRounds7NoKey_2HW(blocks *Block2)
func InvRounds7NoKey_4 ¶
func InvRounds7NoKey_4(blocks *Block4)
InvRounds7NoKey_4 performs 7 AES decryption rounds without AddRoundKey on 4 blocks
func InvRounds7NoKey_4HW ¶
func InvRounds7NoKey_4HW(blocks *Block4)
func InvRounds7WithFinal ¶
func InvRounds7WithFinal(block *Block, roundKeys *RoundKeys7)
InvRounds7WithFinal performs 6 full AES decryption rounds + 1 inverse final round
func InvRounds7WithFinalHW ¶
func InvRounds7WithFinalHW(block *Block, roundKeys *RoundKeys7)
func InvRounds7_2 ¶
func InvRounds7_2(blocks *Block2, roundKeys *RoundKeys7)
InvRounds7_2 performs 7 AES decryption rounds on 2 blocks
func InvRounds7_2HW ¶
func InvRounds7_2HW(blocks *Block2, roundKeys *RoundKeys7)
func InvRounds7_4 ¶
func InvRounds7_4(blocks *Block4, roundKeys *RoundKeys7)
InvRounds7_4 performs 7 AES decryption rounds on 4 blocks
func InvRounds7_4HW ¶
func InvRounds7_4HW(blocks *Block4, roundKeys *RoundKeys7)
func InvRounds10 ¶
func InvRounds10(block *Block, roundKeys *RoundKeys10)
InvRounds10 performs 10 AES decryption rounds
func InvRounds10HW ¶
func InvRounds10HW(block *Block, roundKeys *RoundKeys10)
func InvRounds10NoKey ¶
func InvRounds10NoKey(block *Block)
InvRounds10NoKey performs 10 AES decryption rounds without AddRoundKey
func InvRounds10NoKeyHW ¶
func InvRounds10NoKeyHW(block *Block)
func InvRounds10NoKey_2 ¶
func InvRounds10NoKey_2(blocks *Block2)
InvRounds10NoKey_2 performs 10 AES decryption rounds without AddRoundKey on 2 blocks
func InvRounds10NoKey_2HW ¶
func InvRounds10NoKey_2HW(blocks *Block2)
func InvRounds10NoKey_4 ¶
func InvRounds10NoKey_4(blocks *Block4)
InvRounds10NoKey_4 performs 10 AES decryption rounds without AddRoundKey on 4 blocks
func InvRounds10NoKey_4HW ¶
func InvRounds10NoKey_4HW(blocks *Block4)
func InvRounds10WithFinal ¶
func InvRounds10WithFinal(block *Block, roundKeys *RoundKeys10)
InvRounds10WithFinal performs 9 full AES decryption rounds + 1 inverse final round (for AES-128)
func InvRounds10WithFinalHW ¶
func InvRounds10WithFinalHW(block *Block, roundKeys *RoundKeys10)
func InvRounds10_2 ¶
func InvRounds10_2(blocks *Block2, roundKeys *RoundKeys10)
InvRounds10_2 performs 10 AES decryption rounds on 2 blocks
func InvRounds10_2HW ¶
func InvRounds10_2HW(blocks *Block2, roundKeys *RoundKeys10)
func InvRounds10_4 ¶
func InvRounds10_4(blocks *Block4, roundKeys *RoundKeys10)
InvRounds10_4 performs 10 AES decryption rounds on 4 blocks
func InvRounds10_4HW ¶
func InvRounds10_4HW(blocks *Block4, roundKeys *RoundKeys10)
func InvRounds12 ¶
func InvRounds12(block *Block, roundKeys *RoundKeys12)
InvRounds12 performs 12 AES decryption rounds
func InvRounds12HW ¶
func InvRounds12HW(block *Block, roundKeys *RoundKeys12)
func InvRounds12NoKey ¶
func InvRounds12NoKey(block *Block)
InvRounds12NoKey performs 12 AES decryption rounds without AddRoundKey
func InvRounds12NoKeyHW ¶
func InvRounds12NoKeyHW(block *Block)
func InvRounds12NoKey_2 ¶
func InvRounds12NoKey_2(blocks *Block2)
InvRounds12NoKey_2 performs 12 AES decryption rounds without AddRoundKey on 2 blocks
func InvRounds12NoKey_2HW ¶
func InvRounds12NoKey_2HW(blocks *Block2)
func InvRounds12NoKey_4 ¶
func InvRounds12NoKey_4(blocks *Block4)
InvRounds12NoKey_4 performs 12 AES decryption rounds without AddRoundKey on 4 blocks
func InvRounds12NoKey_4HW ¶
func InvRounds12NoKey_4HW(blocks *Block4)
func InvRounds12WithFinal ¶
func InvRounds12WithFinal(block *Block, roundKeys *RoundKeys12)
InvRounds12WithFinal performs 11 full AES decryption rounds + 1 inverse final round (for AES-192)
func InvRounds12WithFinalHW ¶
func InvRounds12WithFinalHW(block *Block, roundKeys *RoundKeys12)
func InvRounds12_2 ¶
func InvRounds12_2(blocks *Block2, roundKeys *RoundKeys12)
InvRounds12_2 performs 12 AES decryption rounds on 2 blocks
func InvRounds12_2HW ¶
func InvRounds12_2HW(blocks *Block2, roundKeys *RoundKeys12)
func InvRounds12_4 ¶
func InvRounds12_4(blocks *Block4, roundKeys *RoundKeys12)
InvRounds12_4 performs 12 AES decryption rounds on 4 blocks
func InvRounds12_4HW ¶
func InvRounds12_4HW(blocks *Block4, roundKeys *RoundKeys12)
func InvRounds14 ¶
func InvRounds14(block *Block, roundKeys *RoundKeys14)
InvRounds14 performs 14 AES decryption rounds
func InvRounds14HW ¶
func InvRounds14HW(block *Block, roundKeys *RoundKeys14)
func InvRounds14NoKey ¶
func InvRounds14NoKey(block *Block)
InvRounds14NoKey performs 14 AES decryption rounds without AddRoundKey
func InvRounds14NoKeyHW ¶
func InvRounds14NoKeyHW(block *Block)
func InvRounds14NoKey_2 ¶
func InvRounds14NoKey_2(blocks *Block2)
InvRounds14NoKey_2 performs 14 AES decryption rounds without AddRoundKey on 2 blocks
func InvRounds14NoKey_2HW ¶
func InvRounds14NoKey_2HW(blocks *Block2)
func InvRounds14NoKey_4 ¶
func InvRounds14NoKey_4(blocks *Block4)
InvRounds14NoKey_4 performs 14 AES decryption rounds without AddRoundKey on 4 blocks
func InvRounds14NoKey_4HW ¶
func InvRounds14NoKey_4HW(blocks *Block4)
func InvRounds14WithFinal ¶
func InvRounds14WithFinal(block *Block, roundKeys *RoundKeys14)
InvRounds14WithFinal performs 13 full AES decryption rounds + 1 inverse final round (for AES-256)
func InvRounds14WithFinalHW ¶
func InvRounds14WithFinalHW(block *Block, roundKeys *RoundKeys14)
func InvRounds14_2 ¶
func InvRounds14_2(blocks *Block2, roundKeys *RoundKeys14)
InvRounds14_2 performs 14 AES decryption rounds on 2 blocks
func InvRounds14_2HW ¶
func InvRounds14_2HW(blocks *Block2, roundKeys *RoundKeys14)
func InvRounds14_4 ¶
func InvRounds14_4(blocks *Block4, roundKeys *RoundKeys14)
InvRounds14_4 performs 14 AES decryption rounds on 4 blocks
func InvRounds14_4HW ¶
func InvRounds14_4HW(blocks *Block4, roundKeys *RoundKeys14)
func InvSubBytes ¶
func InvSubBytes(block *Block)
InvSubBytes applies the inverse AES S-box substitution.
func MixColumns ¶
func MixColumns(block *Block)
MixColumns mixes bytes within each column using GF(2^8) multiplication.
func OptimalParallelBlocks ¶
func OptimalParallelBlocks() int
OptimalParallelBlocks returns the optimal number of AES blocks that should be processed in parallel on the current CPU for best performance:
- 4: AVX512 with VAES, or ARM Crypto Extensions
- 2: AVX2 with VAES (without AVX512), or ARM Crypto Extensions
- 1: Single-block hardware acceleration only, or software fallback
Use this function to decide whether to use Block2, Block4, or single Block operations for maximum throughput.
func PadTweak ¶
PadTweak pads an 8-byte tweak to 16 bytes. The padding scheme places each 2-byte pair at the start of each 4-byte group: 8-byte tweak: [T0 T1 T2 T3 T4 T5 T6 T7] 16-byte padded: [T0 T1 00 00 T2 T3 00 00 T4 T5 00 00 T6 T7 00 00]
func PerBlockRounds4_2 ¶
func PerBlockRounds4_2(blocks *Block2, keySets *PerBlockRoundKeys4_2)
PerBlockRounds4_2 performs 4 rounds on 2 blocks, each with its own keys
func PerBlockRounds4_2HW ¶
func PerBlockRounds4_2HW(blocks *Block2, keySets *PerBlockRoundKeys4_2)
func PerBlockRounds4_4 ¶
func PerBlockRounds4_4(blocks *Block4, keySets *PerBlockRoundKeys4_4)
PerBlockRounds4_4 performs 4 rounds on 4 blocks, each with its own keys
func PerBlockRounds4_4HW ¶
func PerBlockRounds4_4HW(blocks *Block4, keySets *PerBlockRoundKeys4_4)
func PerBlockRounds7_2 ¶
func PerBlockRounds7_2(blocks *Block2, keySets *PerBlockRoundKeys7_2)
PerBlockRounds7_2 performs 7 rounds on 2 blocks, each with its own keys
func PerBlockRounds7_2HW ¶
func PerBlockRounds7_2HW(blocks *Block2, keySets *PerBlockRoundKeys7_2)
func PerBlockRounds7_4 ¶
func PerBlockRounds7_4(blocks *Block4, keySets *PerBlockRoundKeys7_4)
PerBlockRounds7_4 performs 7 rounds on 4 blocks, each with its own keys
func PerBlockRounds7_4HW ¶
func PerBlockRounds7_4HW(blocks *Block4, keySets *PerBlockRoundKeys7_4)
func PerBlockRounds10WithFinal_2 ¶
func PerBlockRounds10WithFinal_2(blocks *Block2, keySets *PerBlockRoundKeys10_2)
PerBlockRounds10WithFinal_2 performs 9 full rounds + 1 final round on 2 blocks, each with its own keys
func PerBlockRounds10WithFinal_2HW ¶
func PerBlockRounds10WithFinal_2HW(blocks *Block2, keySets *PerBlockRoundKeys10_2)
func PerBlockRounds10WithFinal_4 ¶
func PerBlockRounds10WithFinal_4(blocks *Block4, keySets *PerBlockRoundKeys10_4)
PerBlockRounds10WithFinal_4 performs 9 full rounds + 1 final round on 4 blocks, each with its own keys
func PerBlockRounds10WithFinal_4HW ¶
func PerBlockRounds10WithFinal_4HW(blocks *Block4, keySets *PerBlockRoundKeys10_4)
func PerBlockRounds10_2 ¶
func PerBlockRounds10_2(blocks *Block2, keySets *PerBlockRoundKeys10_2)
PerBlockRounds10_2 performs 10 rounds on 2 blocks, each with its own keys
func PerBlockRounds10_2HW ¶
func PerBlockRounds10_2HW(blocks *Block2, keySets *PerBlockRoundKeys10_2)
func PerBlockRounds10_4 ¶
func PerBlockRounds10_4(blocks *Block4, keySets *PerBlockRoundKeys10_4)
PerBlockRounds10_4 performs 10 rounds on 4 blocks, each with its own keys
func PerBlockRounds10_4HW ¶
func PerBlockRounds10_4HW(blocks *Block4, keySets *PerBlockRoundKeys10_4)
func PerBlockRounds12WithFinal_2 ¶
func PerBlockRounds12WithFinal_2(blocks *Block2, keySets *PerBlockRoundKeys12_2)
PerBlockRounds12WithFinal_2 performs 11 full rounds + 1 final round on 2 blocks, each with its own keys
func PerBlockRounds12WithFinal_2HW ¶
func PerBlockRounds12WithFinal_2HW(blocks *Block2, keySets *PerBlockRoundKeys12_2)
func PerBlockRounds12WithFinal_4 ¶
func PerBlockRounds12WithFinal_4(blocks *Block4, keySets *PerBlockRoundKeys12_4)
PerBlockRounds12WithFinal_4 performs 11 full rounds + 1 final round on 4 blocks, each with its own keys
func PerBlockRounds12WithFinal_4HW ¶
func PerBlockRounds12WithFinal_4HW(blocks *Block4, keySets *PerBlockRoundKeys12_4)
func PerBlockRounds12_2 ¶
func PerBlockRounds12_2(blocks *Block2, keySets *PerBlockRoundKeys12_2)
PerBlockRounds12_2 performs 12 rounds on 2 blocks, each with its own keys
func PerBlockRounds12_2HW ¶
func PerBlockRounds12_2HW(blocks *Block2, keySets *PerBlockRoundKeys12_2)
func PerBlockRounds12_4 ¶
func PerBlockRounds12_4(blocks *Block4, keySets *PerBlockRoundKeys12_4)
PerBlockRounds12_4 performs 12 rounds on 4 blocks, each with its own keys
func PerBlockRounds12_4HW ¶
func PerBlockRounds12_4HW(blocks *Block4, keySets *PerBlockRoundKeys12_4)
func PerBlockRounds14WithFinal_2 ¶
func PerBlockRounds14WithFinal_2(blocks *Block2, keySets *PerBlockRoundKeys14_2)
PerBlockRounds14WithFinal_2 performs 13 full rounds + 1 final round on 2 blocks, each with its own keys
func PerBlockRounds14WithFinal_2HW ¶
func PerBlockRounds14WithFinal_2HW(blocks *Block2, keySets *PerBlockRoundKeys14_2)
func PerBlockRounds14WithFinal_4 ¶
func PerBlockRounds14WithFinal_4(blocks *Block4, keySets *PerBlockRoundKeys14_4)
PerBlockRounds14WithFinal_4 performs 13 full rounds + 1 final round on 4 blocks, each with its own keys
func PerBlockRounds14WithFinal_4HW ¶
func PerBlockRounds14WithFinal_4HW(blocks *Block4, keySets *PerBlockRoundKeys14_4)
func PerBlockRounds14_2 ¶
func PerBlockRounds14_2(blocks *Block2, keySets *PerBlockRoundKeys14_2)
PerBlockRounds14_2 performs 14 rounds on 2 blocks, each with its own keys
func PerBlockRounds14_2HW ¶
func PerBlockRounds14_2HW(blocks *Block2, keySets *PerBlockRoundKeys14_2)
func PerBlockRounds14_4 ¶
func PerBlockRounds14_4(blocks *Block4, keySets *PerBlockRoundKeys14_4)
PerBlockRounds14_4 performs 14 rounds on 4 blocks, each with its own keys
func PerBlockRounds14_4HW ¶
func PerBlockRounds14_4HW(blocks *Block4, keySets *PerBlockRoundKeys14_4)
func Pholkos256Decrypt ¶
func Pholkos256Decrypt(block *Pholkos256Block, key *Pholkos256Key, tweak *PholkosTweak)
Pholkos256Decrypt decrypts a single 256-bit block.
func Pholkos256Encrypt ¶
func Pholkos256Encrypt(block *Pholkos256Block, key *Pholkos256Key, tweak *PholkosTweak)
Pholkos256Encrypt encrypts a single 256-bit block. This is a convenience function that creates a context and encrypts.
func Pholkos512Decrypt ¶
func Pholkos512Decrypt(block *Pholkos512Block, key *Pholkos256Key, tweak *PholkosTweak)
Pholkos512Decrypt decrypts a single 512-bit block with a 256-bit key.
func Pholkos512Decrypt512 ¶
func Pholkos512Decrypt512(block *Pholkos512Block, key *Pholkos512Key, tweak *PholkosTweak)
Pholkos512Decrypt512 decrypts a single 512-bit block with a 512-bit key.
func Pholkos512Encrypt ¶
func Pholkos512Encrypt(block *Pholkos512Block, key *Pholkos256Key, tweak *PholkosTweak)
Pholkos512Encrypt encrypts a single 512-bit block with a 256-bit key.
func Pholkos512Encrypt512 ¶
func Pholkos512Encrypt512(block *Pholkos512Block, key *Pholkos512Key, tweak *PholkosTweak)
Pholkos512Encrypt512 encrypts a single 512-bit block with a 512-bit key.
func Round2 ¶
Round2 performs one AES encryption round on 2 blocks simultaneously. Each block is processed with its corresponding round key from roundKeys. This is a software implementation; use Round2HW for hardware acceleration.
func Round2HW ¶
Round2HW performs one AES encryption round on 2 blocks with hardware acceleration if available
func Round4 ¶
Round4 performs one AES encryption round on 4 blocks simultaneously. Each block is processed with its corresponding round key from roundKeys. This is a software implementation; use Round4HW for hardware acceleration.
func Round4HW ¶
Round4HW performs one AES encryption round on 4 blocks with hardware acceleration if available
func RoundKeyFirst ¶
RoundKeyFirst performs AddRoundKey, SubBytes, ShiftRows, MixColumns.
func RoundKeyFirst2 ¶
RoundKeyFirst2 performs one AES encryption round on 2 blocks in parallel with key XOR first (software)
func RoundKeyFirst2HW ¶
func RoundKeyFirst4 ¶
RoundKeyFirst4 performs one AES encryption round on 4 blocks in parallel with key XOR first (software)
func RoundKeyFirst4HW ¶
func RoundKeyFirstHW ¶
KeyFirst variants fall back to software on Intel since AES-NI instructions naturally XOR the key at the end (standard semantics)
func RoundNoKey ¶
func RoundNoKey(block *Block)
RoundNoKey performs SubBytes, ShiftRows, MixColumns (no key XOR).
func RoundNoKey2 ¶
func RoundNoKey2(blocks *Block2)
RoundNoKey2 performs one AES encryption round on 2 blocks in parallel without AddRoundKey (software)
func RoundNoKey2HW ¶
func RoundNoKey2HW(blocks *Block2)
func RoundNoKey4 ¶
func RoundNoKey4(blocks *Block4)
RoundNoKey4 performs one AES encryption round on 4 blocks in parallel without AddRoundKey (software)
func RoundNoKey4HW ¶
func RoundNoKey4HW(blocks *Block4)
func RoundNoKeyHW ¶
func RoundNoKeyHW(block *Block)
NoKey variants use software fallback on Intel since AES-NI instructions always include the key XOR operation
func Rounds4 ¶
func Rounds4(block *Block, roundKeys *RoundKeys4)
Rounds4 performs 4 AES encryption rounds (SubBytes, ShiftRows, MixColumns, AddRoundKey)
func Rounds4HW ¶
func Rounds4HW(block *Block, roundKeys *RoundKeys4)
func Rounds4NoKey ¶
func Rounds4NoKey(block *Block)
Rounds4NoKey performs 4 AES encryption rounds without AddRoundKey
func Rounds4NoKeyHW ¶
func Rounds4NoKeyHW(block *Block)
func Rounds4NoKey_2 ¶
func Rounds4NoKey_2(blocks *Block2)
Rounds4NoKey_2 performs 4 AES encryption rounds without AddRoundKey on 2 blocks
func Rounds4NoKey_2HW ¶
func Rounds4NoKey_2HW(blocks *Block2)
func Rounds4NoKey_4 ¶
func Rounds4NoKey_4(blocks *Block4)
Rounds4NoKey_4 performs 4 AES encryption rounds without AddRoundKey on 4 blocks
func Rounds4NoKey_4HW ¶
func Rounds4NoKey_4HW(blocks *Block4)
func Rounds4_2 ¶
func Rounds4_2(blocks *Block2, roundKeys *RoundKeys4)
Rounds4_2 performs 4 AES encryption rounds on 2 blocks
func Rounds4_2HW ¶
func Rounds4_2HW(blocks *Block2, roundKeys *RoundKeys4)
func Rounds4_4 ¶
func Rounds4_4(blocks *Block4, roundKeys *RoundKeys4)
Rounds4_4 performs 4 AES encryption rounds on 4 blocks
func Rounds4_4HW ¶
func Rounds4_4HW(blocks *Block4, roundKeys *RoundKeys4)
func Rounds6 ¶
func Rounds6(block *Block, roundKeys *RoundKeys6)
Rounds6 performs 6 AES encryption rounds
func Rounds6HW ¶
func Rounds6HW(block *Block, roundKeys *RoundKeys6)
func Rounds6WithFinal ¶
func Rounds6WithFinal(block *Block, roundKeys *RoundKeys6)
Rounds6WithFinal performs 5 full AES encryption rounds + 1 final round This is useful for constructions like AES-PRF where you need 5+1 rounds (5 rounds with MixColumns, final round without)
func Rounds6WithFinalHW ¶
func Rounds6WithFinalHW(block *Block, roundKeys *RoundKeys6)
func Rounds7 ¶
func Rounds7(block *Block, roundKeys *RoundKeys7)
Rounds7 performs 7 AES encryption rounds
func Rounds7HW ¶
func Rounds7HW(block *Block, roundKeys *RoundKeys7)
func Rounds7NoKey ¶
func Rounds7NoKey(block *Block)
Rounds7NoKey performs 7 AES encryption rounds without AddRoundKey
func Rounds7NoKeyHW ¶
func Rounds7NoKeyHW(block *Block)
func Rounds7NoKey_2 ¶
func Rounds7NoKey_2(blocks *Block2)
Rounds7NoKey_2 performs 7 AES encryption rounds without AddRoundKey on 2 blocks
func Rounds7NoKey_2HW ¶
func Rounds7NoKey_2HW(blocks *Block2)
func Rounds7NoKey_4 ¶
func Rounds7NoKey_4(blocks *Block4)
Rounds7NoKey_4 performs 7 AES encryption rounds without AddRoundKey on 4 blocks
func Rounds7NoKey_4HW ¶
func Rounds7NoKey_4HW(blocks *Block4)
func Rounds7_2 ¶
func Rounds7_2(blocks *Block2, roundKeys *RoundKeys7)
Rounds7_2 performs 7 AES encryption rounds on 2 blocks
func Rounds7_2HW ¶
func Rounds7_2HW(blocks *Block2, roundKeys *RoundKeys7)
func Rounds7_4 ¶
func Rounds7_4(blocks *Block4, roundKeys *RoundKeys7)
Rounds7_4 performs 7 AES encryption rounds on 4 blocks
func Rounds7_4HW ¶
func Rounds7_4HW(blocks *Block4, roundKeys *RoundKeys7)
func Rounds10 ¶
func Rounds10(block *Block, roundKeys *RoundKeys10)
Rounds10 performs 10 AES encryption rounds
func Rounds10HW ¶
func Rounds10HW(block *Block, roundKeys *RoundKeys10)
func Rounds10NoKey ¶
func Rounds10NoKey(block *Block)
Rounds10NoKey performs 10 AES encryption rounds without AddRoundKey
func Rounds10NoKeyHW ¶
func Rounds10NoKeyHW(block *Block)
func Rounds10NoKey_2 ¶
func Rounds10NoKey_2(blocks *Block2)
Rounds10NoKey_2 performs 10 AES encryption rounds without AddRoundKey on 2 blocks
func Rounds10NoKey_2HW ¶
func Rounds10NoKey_2HW(blocks *Block2)
func Rounds10NoKey_4 ¶
func Rounds10NoKey_4(blocks *Block4)
Rounds10NoKey_4 performs 10 AES encryption rounds without AddRoundKey on 4 blocks
func Rounds10NoKey_4HW ¶
func Rounds10NoKey_4HW(blocks *Block4)
func Rounds10WithFinal ¶
func Rounds10WithFinal(block *Block, roundKeys *RoundKeys10)
Rounds10WithFinal performs 9 full AES encryption rounds + 1 final round (for AES-128) This is the standard AES-128 structure: 9 rounds with MixColumns, final round without
func Rounds10WithFinalHW ¶
func Rounds10WithFinalHW(block *Block, roundKeys *RoundKeys10)
func Rounds10WithFinal_4 ¶
func Rounds10WithFinal_4(blocks *Block4, roundKeys *RoundKeys10)
Rounds10WithFinal_4 performs 9 full AES encryption rounds + 1 final round on 4 blocks
func Rounds10WithFinal_4HW ¶
func Rounds10WithFinal_4HW(blocks *Block4, roundKeys *RoundKeys10)
func Rounds10_2 ¶
func Rounds10_2(blocks *Block2, roundKeys *RoundKeys10)
Rounds10_2 performs 10 AES encryption rounds on 2 blocks
func Rounds10_2HW ¶
func Rounds10_2HW(blocks *Block2, roundKeys *RoundKeys10)
func Rounds10_4 ¶
func Rounds10_4(blocks *Block4, roundKeys *RoundKeys10)
Rounds10_4 performs 10 AES encryption rounds on 4 blocks
func Rounds10_4HW ¶
func Rounds10_4HW(blocks *Block4, roundKeys *RoundKeys10)
func Rounds12 ¶
func Rounds12(block *Block, roundKeys *RoundKeys12)
Rounds12 performs 12 AES encryption rounds
func Rounds12HW ¶
func Rounds12HW(block *Block, roundKeys *RoundKeys12)
func Rounds12NoKey ¶
func Rounds12NoKey(block *Block)
Rounds12NoKey performs 12 AES encryption rounds without AddRoundKey
func Rounds12NoKeyHW ¶
func Rounds12NoKeyHW(block *Block)
func Rounds12NoKey_2 ¶
func Rounds12NoKey_2(blocks *Block2)
Rounds12NoKey_2 performs 12 AES encryption rounds without AddRoundKey on 2 blocks
func Rounds12NoKey_2HW ¶
func Rounds12NoKey_2HW(blocks *Block2)
func Rounds12NoKey_4 ¶
func Rounds12NoKey_4(blocks *Block4)
Rounds12NoKey_4 performs 12 AES encryption rounds without AddRoundKey on 4 blocks
func Rounds12NoKey_4HW ¶
func Rounds12NoKey_4HW(blocks *Block4)
func Rounds12WithFinal ¶
func Rounds12WithFinal(block *Block, roundKeys *RoundKeys12)
Rounds12WithFinal performs 11 full AES encryption rounds + 1 final round (for AES-192)
func Rounds12WithFinalHW ¶
func Rounds12WithFinalHW(block *Block, roundKeys *RoundKeys12)
func Rounds12WithFinal_4 ¶
func Rounds12WithFinal_4(blocks *Block4, roundKeys *RoundKeys12)
Rounds12WithFinal_4 performs 11 full AES encryption rounds + 1 final round on 4 blocks
func Rounds12WithFinal_4HW ¶
func Rounds12WithFinal_4HW(blocks *Block4, roundKeys *RoundKeys12)
func Rounds12_2 ¶
func Rounds12_2(blocks *Block2, roundKeys *RoundKeys12)
Rounds12_2 performs 12 AES encryption rounds on 2 blocks
func Rounds12_2HW ¶
func Rounds12_2HW(blocks *Block2, roundKeys *RoundKeys12)
func Rounds12_4 ¶
func Rounds12_4(blocks *Block4, roundKeys *RoundKeys12)
Rounds12_4 performs 12 AES encryption rounds on 4 blocks
func Rounds12_4HW ¶
func Rounds12_4HW(blocks *Block4, roundKeys *RoundKeys12)
func Rounds14 ¶
func Rounds14(block *Block, roundKeys *RoundKeys14)
Rounds14 performs 14 AES encryption rounds
func Rounds14HW ¶
func Rounds14HW(block *Block, roundKeys *RoundKeys14)
func Rounds14NoKey ¶
func Rounds14NoKey(block *Block)
Rounds14NoKey performs 14 AES encryption rounds without AddRoundKey
func Rounds14NoKeyHW ¶
func Rounds14NoKeyHW(block *Block)
func Rounds14NoKey_2 ¶
func Rounds14NoKey_2(blocks *Block2)
Rounds14NoKey_2 performs 14 AES encryption rounds without AddRoundKey on 2 blocks
func Rounds14NoKey_2HW ¶
func Rounds14NoKey_2HW(blocks *Block2)
func Rounds14NoKey_4 ¶
func Rounds14NoKey_4(blocks *Block4)
Rounds14NoKey_4 performs 14 AES encryption rounds without AddRoundKey on 4 blocks
func Rounds14NoKey_4HW ¶
func Rounds14NoKey_4HW(blocks *Block4)
func Rounds14WithFinal ¶
func Rounds14WithFinal(block *Block, roundKeys *RoundKeys14)
Rounds14WithFinal performs 13 full AES encryption rounds + 1 final round (for AES-256)
func Rounds14WithFinalHW ¶
func Rounds14WithFinalHW(block *Block, roundKeys *RoundKeys14)
func Rounds14WithFinal_4 ¶
func Rounds14WithFinal_4(blocks *Block4, roundKeys *RoundKeys14)
Rounds14WithFinal_4 performs 13 full AES encryption rounds + 1 final round on 4 blocks
func Rounds14WithFinal_4HW ¶
func Rounds14WithFinal_4HW(blocks *Block4, roundKeys *RoundKeys14)
func Rounds14_2 ¶
func Rounds14_2(blocks *Block2, roundKeys *RoundKeys14)
Rounds14_2 performs 14 AES encryption rounds on 2 blocks
func Rounds14_2HW ¶
func Rounds14_2HW(blocks *Block2, roundKeys *RoundKeys14)
func Rounds14_4 ¶
func Rounds14_4(blocks *Block4, roundKeys *RoundKeys14)
Rounds14_4 performs 14 AES encryption rounds on 4 blocks
func Rounds14_4HW ¶
func Rounds14_4HW(blocks *Block4, roundKeys *RoundKeys14)
func ShiftRows ¶
func ShiftRows(block *Block)
ShiftRows cyclically shifts bytes in each row (0,1,2,3 bytes respectively).
func SubBytes ¶
func SubBytes(block *Block)
SubBytes applies the AES S-box substitution to each byte.
func UseHardwareAcceleration ¶
func UseHardwareAcceleration() bool
UseHardwareAcceleration returns true if single-block hardware AES acceleration is available (Intel AES-NI or ARM Crypto Extensions). When true, *HW functions will use hardware instructions instead of software implementations.
func UseVectorAcceleration ¶
func UseVectorAcceleration() bool
UseVectorAcceleration returns true if vector AES acceleration (VAES) is available for parallel block processing. This requires VAES support plus either AVX2 (for 2 blocks) or AVX512 (for 4 blocks).
func Vistrutah256Decrypt ¶
Vistrutah256Decrypt decrypts a 32-byte ciphertext block using Vistrutah-256.
func Vistrutah256DecryptHW ¶
Vistrutah256DecryptHW decrypts a 256-bit block using hardware AES-NI
func Vistrutah256Encrypt ¶
Vistrutah256Encrypt encrypts a 32-byte plaintext block using Vistrutah-256. Key must be 16 or 32 bytes. Rounds should be Vistrutah256RoundsShort (10) or Vistrutah256RoundsLong (14).
func Vistrutah256EncryptHW ¶
Vistrutah256EncryptHW encrypts a 256-bit block using hardware AES-NI
func Vistrutah256MP ¶ added in v0.1.1
Vistrutah256MP computes a keyed hash using the Miyaguchi-Preneel construction: h = E(k, X) XOR k XOR X. This is one of the 12 provably secure PGV compression functions (Black-Rogaway-Shrimpton, CRYPTO 2002). Input is a fixed 32-byte block, key must be 16 or 32 bytes. Returns a 32-byte digest.
func Vistrutah512Decrypt ¶
Vistrutah512Decrypt decrypts a 64-byte ciphertext block using Vistrutah-512.
func Vistrutah512DecryptHW ¶
Vistrutah512DecryptHW decrypts a 512-bit block using hardware AES-NI
func Vistrutah512Encrypt ¶
Vistrutah512Encrypt encrypts a 64-byte plaintext block using Vistrutah-512. Key must be 32 or 64 bytes.
func Vistrutah512EncryptHW ¶
Vistrutah512EncryptHW encrypts a 512-bit block using hardware AES-NI
func Vistrutah512MP ¶ added in v0.1.1
Vistrutah512MP computes a keyed hash using the Miyaguchi-Preneel construction: h = E(k, X) XOR k XOR X. This is one of the 12 provably secure PGV compression functions (Black-Rogaway-Shrimpton, CRYPTO 2002). Input is a fixed 64-byte block, key must be 32 or 64 bytes. Returns a 64-byte digest.
Types ¶
type AESPRF ¶
type AESPRF struct {
// contains filtered or unexported fields
}
AESPRF implements the AES-PRF construction with 4 rounds before feed-forward and 6 rounds after feed-forward (5 full + 1 final).
The construction is:
- Apply initial AddRoundKey with round key 0
- Apply 4 full AES rounds (SubBytes, ShiftRows, MixColumns, AddRoundKey)
- XOR the result with the original input (feed-forward)
- Apply 5 full AES rounds (SubBytes, ShiftRows, MixColumns, AddRoundKey)
- Apply final round (SubBytes, ShiftRows, AddRoundKey, no MixColumns)
This construction provides a pseudorandom function (PRF) based on the AES round function. The feed-forward XOR adds non-linearity that makes the construction particularly suitable for use in cryptographic hash functions, MACs, and key derivation.
Performance: ~152 ns/op with zero allocations on Apple M4 ARM64. Hardware acceleration (Intel AES-NI, ARM Crypto) is automatically used when available.
func NewAESPRF ¶
NewAESPRF creates a new AES-PRF instance with the given key. The key must be 16, 24, or 32 bytes for AES-128, AES-192, or AES-256 respectively.
For AES-PRF, we use a 10-round structure regardless of key size:
- 1 initial AddRoundKey
- 4 full rounds
- XOR feed-forward
- 5 full rounds
- 1 final round (no MixColumns)
This gives us a total of 10 rounds, matching AES-128 structure.
func (*AESPRF) PRF ¶
PRF applies the AES-PRF construction to the input block. The input block is modified in place to contain the output.
The construction:
- state = AddRoundKey(input, roundKey[0])
- 4 full AES rounds using Rounds4HW (roundKeys[1-4])
- state = state ⊕ input (feed-forward)
- 5 full rounds + 1 final round using Rounds6WithFinalHW (roundKeys[5-10])
This implementation uses optimized multi-round functions (Rounds4HW and Rounds6WithFinalHW) for maximum performance. Hardware acceleration is automatically used when available.
Security: The 4+6 round configuration with feed-forward at round 4 provides security against known cryptanalytic attacks on AES-PRF constructions.
type Areion256 ¶
type Areion256 [32]byte
Areion256 represents a 256-bit (32-byte) state for the Areion256 permutation. Areion256 is a wide-block cryptographic permutation built from AES round functions, designed for hash functions and authenticated encryption. The state consists of two 128-bit AES blocks processed through 10 rounds. The permutation uses round constants derived from the digits of pi and is hardware-accelerated on platforms with AES-NI or ARM Crypto Extensions.
func (*Areion256) InversePermute ¶
func (state *Areion256) InversePermute()
InversePermute applies the inverse of the Areion256 permutation in-place. This inverts the transformation performed by Permute, satisfying InversePermute(Permute(state)) == state. Like Permute, it automatically uses hardware acceleration when available.
func (*Areion256) Permute ¶
func (state *Areion256) Permute()
Permute applies the 10-round Areion256 permutation in-place. The permutation transforms the 32-byte state using AES round functions and pi-based constants. Automatically uses hardware acceleration (AES-NI or ARM Crypto) when available, otherwise falls back to software implementation. The permutation is designed to be secure for cryptographic applications like hash functions and MACs.
type Areion512 ¶
type Areion512 [64]byte
Areion512 represents a 512-bit (64-byte) state for the Areion512 permutation. Areion512 is a wide-block cryptographic permutation providing higher throughput than Areion256 for large constructions. The state consists of four 128-bit AES blocks processed through 15 rounds. Like Areion256, it uses pi-based round constants and is hardware-accelerated on platforms with AES-NI or ARM Crypto.
func (*Areion512) InversePermute ¶
func (state *Areion512) InversePermute()
InversePermute applies the inverse of the Areion512 permutation in-place. This inverts the transformation performed by Permute, satisfying InversePermute(Permute(state)) == state. Like Permute, it automatically uses hardware acceleration when available.
func (*Areion512) Permute ¶
func (state *Areion512) Permute()
Permute applies the 15-round Areion512 permutation in-place. The permutation transforms the 64-byte state using AES round functions and pi-based constants, providing higher throughput than Areion256 for applications processing large amounts of data. Automatically uses hardware acceleration when available.
type Block ¶
type Block [16]byte
Block represents a 128-bit AES block (16 bytes)
func DeoxysBC256Decrypt ¶
func DeoxysBC256Decrypt(rk *DeoxysBC256RoundKeys, ciphertext *Block) Block
DeoxysBC256Decrypt decrypts a block using Deoxys-BC-256 (14 rounds).
func DeoxysBC256DecryptHW ¶
func DeoxysBC256DecryptHW(rk *DeoxysBC256RoundKeysHW, ciphertext *Block) Block
DeoxysBC256DecryptHW decrypts using hardware-accelerated Deoxys-BC-256
func DeoxysBC256Encrypt ¶
func DeoxysBC256Encrypt(rk *DeoxysBC256RoundKeys, plaintext *Block) Block
DeoxysBC256Encrypt encrypts a block using Deoxys-BC-256 (14 rounds).
func DeoxysBC256EncryptHW ¶
func DeoxysBC256EncryptHW(rk *DeoxysBC256RoundKeys, plaintext *Block) Block
DeoxysBC256EncryptHW encrypts using hardware-accelerated Deoxys-BC-256
func DeoxysRoundConstant ¶
DeoxysRoundConstant generates a round constant with optional domain separation. Format: column 0 = [1,2,4,8], column 1 = [rc,rc,rc,rc], column 2 = [domain,domain,domain,domain]
func Haraka256ToBlock ¶
Haraka256ToBlock computes Haraka-256 and returns a single 16-byte block. This is a convenience function that takes only the first half of the output.
func Haraka512ToBlock ¶
Haraka512ToBlock computes Haraka-512 and returns a single 16-byte block. This is a convenience function that takes only the first half of the output.
type Block2 ¶
type Block2 [32]byte
Block2 represents two 128-bit AES blocks (32 bytes total) for parallel processing. Used with AVX2/VAES (256-bit vectors) or ARM Crypto Extensions to process two independent blocks simultaneously. Layout: [block0|block1] where each block is 16 bytes.
type Block4 ¶
type Block4 [64]byte
Block4 represents four 128-bit AES blocks (64 bytes total) for parallel processing. Used with AVX512/VAES (512-bit vectors) or ARM Crypto Extensions to process four independent blocks simultaneously. Layout: [block0|block1|block2|block3] where each block is 16 bytes.
type ButterKnifeContext ¶
type ButterKnifeContext struct {
// contains filtered or unexported fields
}
ButterKnifeContext holds pre-expanded tweakey for multiple ButterKnife evaluations
func NewButterKnifeContext ¶
func NewButterKnifeContext(tweakey *Tweakey256) *ButterKnifeContext
NewButterKnifeContext creates a context with pre-expanded tweakey
func (*ButterKnifeContext) Eval ¶
func (ctx *ButterKnifeContext) Eval(input *Block) *ButterKnifeOutput
Eval evaluates ButterKnife with the pre-expanded tweakey
type ButterKnifeContextHW ¶
type ButterKnifeContextHW struct {
// contains filtered or unexported fields
}
ButterKnifeContextHW holds pre-expanded tweakey for hardware-accelerated evaluation
func NewButterKnifeContextHW ¶
func NewButterKnifeContextHW(tweakey *Tweakey256) *ButterKnifeContextHW
NewButterKnifeContextHW creates a context with pre-computed subtweakeys
func (*ButterKnifeContextHW) EvalHW ¶
func (ctx *ButterKnifeContextHW) EvalHW(input *Block) *ButterKnifeOutput
EvalHW evaluates ButterKnife with hardware acceleration
type ButterKnifeOutput ¶
type ButterKnifeOutput [8]Block
ButterKnifeOutput holds the 8 output branches (1024 bits total)
func ButterKnife ¶
func ButterKnife(tweakey *Tweakey256, input *Block) *ButterKnifeOutput
ButterKnife computes the ButterKnife TPRF on input using the given tweakey. Input: 128-bit block Output: 1024 bits (8 × 128-bit blocks)
func ButterKnifeHW ¶
func ButterKnifeHW(tweakey *Tweakey256, input *Block) *ButterKnifeOutput
ButterKnifeHW evaluates ButterKnife TPRF with hardware acceleration
type CPUFeatures ¶
type CPUFeatures struct {
HasAESNI bool // Intel AES-NI instructions (AESENC/AESDEC)
HasARMCrypto bool // ARM Crypto Extensions (AESE/AESD)
HasVAES bool // Vector AES instructions (VAESENC/VAESDEC)
HasAVX2 bool // AVX2 support for 256-bit vectors (2 AES blocks with VAES)
HasAVX512 bool // AVX512 support for 512-bit vectors (4 AES blocks with VAES)
}
CPUFeatures holds information about available CPU hardware acceleration features for AES operations. These flags are automatically detected at package initialization and used to select optimal implementations.
var CPU CPUFeatures
CPU holds the detected CPU features for the current processor. This variable is initialized automatically at package init time. Check these fields to determine which hardware acceleration is available.
type DeoxysBC256RoundKeys ¶
type DeoxysBC256RoundKeys struct {
STK [15]Block
}
DeoxysBC256RoundKeys holds the 15 precomputed subtweakeys for standard Deoxys-BC-256
func NewDeoxysBC256 ¶
func NewDeoxysBC256(tweakey *Tweakey256) *DeoxysBC256RoundKeys
NewDeoxysBC256 expands a 256-bit tweakey into precomputed subtweakeys. Uses GF(2^8) multiplication for TK2 as per SUPERCOP reference.
type DeoxysBC256RoundKeysHW ¶
type DeoxysBC256RoundKeysHW struct {
DeoxysBC256RoundKeys
// InvSTK holds InvMixColumns(STK[1..13]) for hardware-accelerated decryption.
// InvSTK[i] corresponds to InvMixColumns(STK[i]) for i in 1..13.
// InvSTK[0] and InvSTK[14] are unused (first and last rounds don't use InvMixColumns).
InvSTK [15]Block
}
DeoxysBC256RoundKeysHW holds precomputed keys for hardware-accelerated Deoxys-BC-256. Includes both encryption keys (STK) and inverse keys (InvSTK) for decryption.
func NewDeoxysBC256HW ¶
func NewDeoxysBC256HW(tweakey *Tweakey256) *DeoxysBC256RoundKeysHW
NewDeoxysBC256HW expands a 256-bit tweakey into precomputed subtweakeys for hardware-accelerated encryption and decryption. Includes inverse keys.
type DeoxysRoundTweakeys ¶
DeoxysRoundTweakeys holds expanded tweakey states for domain-separated constructions
func DeoxysExpandTweakey256 ¶
func DeoxysExpandTweakey256(tweakey *Tweakey256) *DeoxysRoundTweakeys
DeoxysExpandTweakey256 expands a tweakey for domain-separated constructions. Returns 17 round tweakey states (indices 0-16) using LFSR2.
type Key2 ¶
type Key2 [32]byte
Key2 represents two 128-bit round keys (32 bytes total) for parallel processing. Each block in a Block2 can be processed with its corresponding key, enabling different keys per lane. Layout: [key0|key1] where each key is 16 bytes.
type Key4 ¶
type Key4 [64]byte
Key4 represents four 128-bit round keys (64 bytes total) for parallel processing. Each block in a Block4 can be processed with its corresponding key, enabling different keys per lane. Layout: [key0|key1|key2|key3] where each key is 16 bytes.
type KeySchedule ¶
type KeySchedule struct {
// contains filtered or unexported fields
}
KeySchedule holds the expanded round keys for AES encryption and decryption. A key schedule is created from a cipher key and contains all the per-round keys needed for AES operations. The number of rounds depends on the key size: 10 rounds for AES-128, 12 for AES-192, and 14 for AES-256.
func InverseKeySchedule ¶
func InverseKeySchedule(encKS *KeySchedule) *KeySchedule
InverseKeySchedule creates a key schedule suitable for AES decryption from an encryption key schedule. This applies InvMixColumns to all middle round keys and reverses their order to match the "equivalent inverse cipher" form from FIPS-197. The first and last keys are copied as-is without InvMixColumns.
func NewKeySchedule ¶
func NewKeySchedule(key []byte) (*KeySchedule, error)
NewKeySchedule creates a key schedule from a cipher key using the AES key expansion algorithm. Supported key sizes:
- 16 bytes (AES-128): 10 rounds
- 24 bytes (AES-192): 12 rounds
- 32 bytes (AES-256): 14 rounds
Returns an error if the key length is invalid.
func (*KeySchedule) GetRoundKey ¶
func (ks *KeySchedule) GetRoundKey(round int) *Block
GetRoundKey returns a pointer to the round key for the specified round number (0-based indexing). Round 0 is the initial key, and subsequent rounds are the expanded keys. Returns nil if the round number is out of range.
func (*KeySchedule) Rounds ¶
func (ks *KeySchedule) Rounds() int
Rounds returns the number of AES rounds for this key schedule: 10 for AES-128, 12 for AES-192, or 14 for AES-256.
type KiasuContext ¶
type KiasuContext struct {
// contains filtered or unexported fields
}
KiasuContext holds the base key schedule for KIASU-BC encryption/decryption. For each encryption/decryption, a tweaked key schedule is created by XORing the base key schedule with the padded tweak.
func NewKiasuContext ¶
func NewKiasuContext(key [16]byte) (*KiasuContext, error)
NewKiasuContext creates a new KIASU-BC context with the given 16-byte key. The key schedule is identical to AES-128.
func (*KiasuContext) KiasuDecrypt ¶
func (ctx *KiasuContext) KiasuDecrypt(block [16]byte, tweak [8]byte) [16]byte
KiasuDecrypt decrypts a single 16-byte block using KIASU-BC. It creates tweaked round keys by XORing the base key schedule with the padded tweak, then performs standard AES-128 decryption using optimized multi-round functions.
func (*KiasuContext) KiasuDecryptHW ¶
func (ctx *KiasuContext) KiasuDecryptHW(block [16]byte, tweak [8]byte) [16]byte
KiasuDecryptHW decrypts a single 16-byte block using KIASU-BC with hardware acceleration. It uses hardware-accelerated multi-round AES functions when available.
func (*KiasuContext) KiasuEncrypt ¶
func (ctx *KiasuContext) KiasuEncrypt(block [16]byte, tweak [8]byte) [16]byte
KiasuEncrypt encrypts a single 16-byte block using KIASU-BC. It creates tweaked round keys by XORing the base key schedule with the padded tweak, then performs standard AES-128 encryption using optimized multi-round functions.
func (*KiasuContext) KiasuEncryptHW ¶
func (ctx *KiasuContext) KiasuEncryptHW(block [16]byte, tweak [8]byte) [16]byte
KiasuEncryptHW encrypts a single 16-byte block using KIASU-BC with hardware acceleration. It uses hardware-accelerated multi-round AES functions when available.
type PerBlockRoundKeys4_2 ¶
type PerBlockRoundKeys4_2 [2]RoundKeys4
PerBlockRoundKeys4_2 holds 4 round keys for each of 2 blocks
type PerBlockRoundKeys4_4 ¶
type PerBlockRoundKeys4_4 [4]RoundKeys4
PerBlockRoundKeys4_4 holds 4 round keys for each of 4 blocks
type PerBlockRoundKeys7_2 ¶
type PerBlockRoundKeys7_2 [2]RoundKeys7
PerBlockRoundKeys7_2 holds 7 round keys for each of 2 blocks
type PerBlockRoundKeys7_4 ¶
type PerBlockRoundKeys7_4 [4]RoundKeys7
PerBlockRoundKeys7_4 holds 7 round keys for each of 4 blocks
type PerBlockRoundKeys10_2 ¶
type PerBlockRoundKeys10_2 [2]RoundKeys10
PerBlockRoundKeys10_2 holds 10 round keys for each of 2 blocks
type PerBlockRoundKeys10_4 ¶
type PerBlockRoundKeys10_4 [4]RoundKeys10
PerBlockRoundKeys10_4 holds 10 round keys for each of 4 blocks
type PerBlockRoundKeys12_2 ¶
type PerBlockRoundKeys12_2 [2]RoundKeys12
PerBlockRoundKeys12_2 holds 12 round keys for each of 2 blocks
type PerBlockRoundKeys12_4 ¶
type PerBlockRoundKeys12_4 [4]RoundKeys12
PerBlockRoundKeys12_4 holds 12 round keys for each of 4 blocks
type PerBlockRoundKeys14_2 ¶
type PerBlockRoundKeys14_2 [2]RoundKeys14
PerBlockRoundKeys14_2 holds 14 round keys for each of 2 blocks
type PerBlockRoundKeys14_4 ¶
type PerBlockRoundKeys14_4 [4]RoundKeys14
PerBlockRoundKeys14_4 holds 14 round keys for each of 4 blocks
type Pholkos256Block ¶
type Pholkos256Block [32]byte
Pholkos256Block represents a 256-bit (32-byte) Pholkos-256 block.
type Pholkos256Context ¶
type Pholkos256Context struct {
// contains filtered or unexported fields
}
Pholkos256Context holds precomputed round tweakeys for Pholkos-256 encryption.
func NewPholkos256Context ¶
func NewPholkos256Context(key *Pholkos256Key, tweak *PholkosTweak) *Pholkos256Context
NewPholkos256Context creates a new Pholkos-256 context with precomputed round tweakeys.
func (*Pholkos256Context) Decrypt ¶
func (ctx *Pholkos256Context) Decrypt(block *Pholkos256Block)
Decrypt decrypts a 256-bit block using the precomputed round tweakeys.
func (*Pholkos256Context) DecryptHW ¶
func (ctx *Pholkos256Context) DecryptHW(block *Pholkos256Block)
DecryptHW decrypts using hardware acceleration if available.
func (*Pholkos256Context) Encrypt ¶
func (ctx *Pholkos256Context) Encrypt(block *Pholkos256Block)
Encrypt encrypts a 256-bit block using the precomputed round tweakeys.
func (*Pholkos256Context) EncryptHW ¶
func (ctx *Pholkos256Context) EncryptHW(block *Pholkos256Block)
EncryptHW encrypts using hardware acceleration if available.
func (*Pholkos256Context) Retweak ¶
func (ctx *Pholkos256Context) Retweak(key *Pholkos256Key, tweak *PholkosTweak)
Retweak updates only the tweak-dependent parts of the round tweakeys.
func (*Pholkos256Context) Schedule ¶
func (ctx *Pholkos256Context) Schedule(key *Pholkos256Key, tweak *PholkosTweak)
Schedule computes the round tweakeys from the key and tweak.
type Pholkos256Key ¶
type Pholkos256Key [32]byte
Pholkos256Key represents a 256-bit (32-byte) key for Pholkos-256 or Pholkos-512-256.
type Pholkos512Block ¶
type Pholkos512Block [64]byte
Pholkos512Block represents a 512-bit (64-byte) Pholkos-512 block.
type Pholkos512Context ¶
type Pholkos512Context struct {
// contains filtered or unexported fields
}
Pholkos512Context holds precomputed round tweakeys for Pholkos-512 encryption.
func NewPholkos512Context ¶
func NewPholkos512Context(key *Pholkos256Key, tweak *PholkosTweak) *Pholkos512Context
NewPholkos512Context creates a new Pholkos-512 context with a 256-bit key.
func NewPholkos512Context512 ¶
func NewPholkos512Context512(key *Pholkos512Key, tweak *PholkosTweak) *Pholkos512Context
NewPholkos512Context512 creates a new Pholkos-512 context with a 512-bit key.
func (*Pholkos512Context) Decrypt ¶
func (ctx *Pholkos512Context) Decrypt(block *Pholkos512Block)
Decrypt decrypts a 512-bit block using the precomputed round tweakeys.
func (*Pholkos512Context) DecryptHW ¶
func (ctx *Pholkos512Context) DecryptHW(block *Pholkos512Block)
DecryptHW decrypts using hardware acceleration if available.
func (*Pholkos512Context) Encrypt ¶
func (ctx *Pholkos512Context) Encrypt(block *Pholkos512Block)
Encrypt encrypts a 512-bit block using the precomputed round tweakeys.
func (*Pholkos512Context) EncryptHW ¶
func (ctx *Pholkos512Context) EncryptHW(block *Pholkos512Block)
EncryptHW encrypts using hardware acceleration if available.
func (*Pholkos512Context) Schedule256 ¶
func (ctx *Pholkos512Context) Schedule256(key *Pholkos256Key, tweak *PholkosTweak)
Schedule256 computes round tweakeys from a 256-bit key and tweak.
func (*Pholkos512Context) Schedule512 ¶
func (ctx *Pholkos512Context) Schedule512(key *Pholkos512Key, tweak *PholkosTweak)
Schedule512 computes round tweakeys from a 512-bit key and tweak.
type Pholkos512Key ¶
type Pholkos512Key [64]byte
Pholkos512Key represents a 512-bit (64-byte) key for Pholkos-512-512.
type RoundKeys4 ¶
type RoundKeys4 [4]Block // 4 round keys for 4 rounds
RoundKeys types for multi-round operations
type RoundKeys6 ¶
type RoundKeys6 [6]Block // 6 round keys for 6 rounds (5 full + 1 final)
RoundKeys types for multi-round operations
type RoundKeys7 ¶
type RoundKeys7 [7]Block // 7 round keys for 7 rounds
RoundKeys types for multi-round operations
type RoundKeys10 ¶
type RoundKeys10 [10]Block // 10 round keys for 10 rounds
RoundKeys types for multi-round operations
type RoundKeys12 ¶
type RoundKeys12 [12]Block // 12 round keys for 12 rounds
RoundKeys types for multi-round operations
type RoundKeys14 ¶
type RoundKeys14 [14]Block // 14 round keys for 14 rounds
RoundKeys types for multi-round operations
type Tweakey256 ¶
type Tweakey256 [32]byte
Tweakey256 represents a 256-bit tweakey (key || tweak, each 128 bits)
Source Files
¶
- aes.go
- aes_prf.go
- aesni_amd64.go
- areion.go
- areion_amd64.go
- areion_hw.go
- butterknife.go
- cpu.go
- deoxys.go
- deoxys_hw_amd64.go
- doc.go
- haraka.go
- haraka_amd64.go
- keyschedule.go
- kiasu.go
- kiasu_hw.go
- multirounds.go
- multirounds_amd64.go
- parallel.go
- pholkos.go
- pholkos_amd64.go
- pholkos_hw.go
- vaes_amd64.go
- vistrutah.go
- vistrutah_amd64.go