cryptoutils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(encrypted []byte, key []byte) ([]byte, error)

AESDecrypt reverses AESEncrypt: it expects nonce||ciphertext produced with the same key and returns the plaintext, erroring on a short or tampered input.

func AESEncrypt

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

AESEncrypt encrypts plaintext with AES-GCM and returns nonce||ciphertext. key must be a valid AES key (16, 24 or 32 bytes); pair with AESDecrypt.

func Text

func Text() string

Text returns a cryptographically-random 16-character base32 string.

func TextWithLen

func TextWithLen(length int) string

TextWithLen returns a cryptographically-random base32 string of the given length (the mapping is unbiased, as 256 is a multiple of the alphabet size).

Types

This section is empty.

Jump to

Keyboard shortcuts

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