Lux Docs
Crypto

Encryption & Key Encapsulation

AES-GCM, ChaCha20-Poly1305, ECIES, ML-KEM (Kyber), and HPKE

Symmetric encryption, hybrid encryption, and post-quantum key encapsulation for securing data at rest and in transit.

Symmetric Encryption

AlgorithmKey SizeNonceTagNotes
AES-256-GCM256-bit96-bit128-bitStandard AEAD, hardware-accelerated
ChaCha20-Poly1305256-bit96-bit128-bitSoftware-optimized AEAD

Hybrid Encryption (ECIES)

Combines ECDH key agreement with AES-GCM symmetric encryption.

import "github.com/luxfi/crypto/ecies"

ciphertext, err := ecies.Encrypt(recipientPubKey, plaintext)
plaintext, err := ecies.Decrypt(recipientPrivKey, ciphertext)

ML-KEM (FIPS 203)

Post-quantum key encapsulation based on lattice problems.

import "github.com/luxfi/crypto/mlkem"

pub, priv, err := mlkem.GenerateKey()
ciphertext, sharedSecret, err := mlkem.Encapsulate(pub)
sharedSecret, err := mlkem.Decapsulate(priv, ciphertext)
Parameter SetSecurityCiphertextShared Secret
ML-KEM-512NIST Level 1768 bytes32 bytes
ML-KEM-768NIST Level 31,088 bytes32 bytes
ML-KEM-1024NIST Level 51,568 bytes32 bytes

Hash Functions

PackageAlgorithms
hash/SHA-256, SHA-512
blake2b/BLAKE2b-256, BLAKE2b-512
hashing/Keccak-256 (Ethereum-compatible)

GPU Acceleration

The gpu/ package auto-routes to GPU for large batches:

OperationGPU Threshold
Poseidon2 batch hash64+ elements
Merkle tree128+ leaves
Multi-scalar multiplication256+ points

On this page