crypto

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key, ciphertext []byte) ([]byte, error)

Decrypt reverses Encrypt. Returns an error if the tag check fails.

func Encrypt

func Encrypt(key, plaintext []byte) ([]byte, error)

Encrypt encrypts plaintext with AES-GCM-256. Output layout: [12-byte nonce][ciphertext][16-byte GCM tag].

func LoadKeyFromEnv

func LoadKeyFromEnv(envVar string) ([]byte, error)

LoadKeyFromEnv reads a 32-byte AES-256 key from the named environment variable. Accepts hex (64 chars), standard/URL-safe base64 (44 chars), or any passphrase (derived to 32 bytes via SHA-256).

Types

This section is empty.

Jump to

Keyboard shortcuts

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