cryptography

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AES256KeySize is the size of an AES-256 key in bytes.
	AES256KeySize = 32 // 256 bits
)
View Source
const (
	SHA256Size = 32
)

Variables

This section is empty.

Functions

func ComputeHMAC

func ComputeHMAC(key, message []byte) []byte

func DecryptAES256CBC added in v0.4.0

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

DecryptAES256CBC decrypts data using AES-256 in CBC mode. It assumes the IV is prepended to the ciphertext.

func DeriveKey

func DeriveKey(secret, salt, info []byte, length int) ([]byte, error)

func DeriveSharedSecret

func DeriveSharedSecret(privateKey, peerPublicKey []byte) ([]byte, error)

func EncryptAES256CBC added in v0.4.0

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

EncryptAES256CBC encrypts data using AES-256 in CBC mode. The IV is prepended to the ciphertext.

func GenerateAES256Key added in v0.4.0

func GenerateAES256Key() ([]byte, error)

GenerateAES256Key generates a random AES-256 key.

func GenerateHMACKey

func GenerateHMACKey(size int) ([]byte, error)

func GenerateKeyPair

func GenerateKeyPair() (privateKey, publicKey []byte, err error)

func GenerateSigningKeyPair

func GenerateSigningKeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error)

func GetBasepoint

func GetBasepoint() []byte

GetBasepoint returns the standard Curve25519 basepoint

func Hash

func Hash(data []byte) []byte

func Sign

func Sign(privateKey ed25519.PrivateKey, message []byte) []byte

func ValidateHMAC

func ValidateHMAC(key, message, messageHMAC []byte) bool

func Verify

func Verify(publicKey ed25519.PublicKey, message, signature []byte) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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