crypto

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SaltLength is the length of salt used for key derivation
	SaltLength = 16
	// KeyLength is the length of derived keys (AES-256)
	KeyLength = 32
	// NonceLength is the length of nonce used for AES-GCM
	NonceLength = 12
	// PBKDF2Iterations is the number of iterations for PBKDF2
	PBKDF2Iterations = 100000
)

Variables

This section is empty.

Functions

func DecryptAES

func DecryptAES(encryptedData []byte, password string) ([]byte, error)

DecryptAES decrypts data using AES-256-GCM with a password-derived key

func DeriveKey

func DeriveKey(password string, salt []byte) ([]byte, error)

DeriveKey derives a key from password and salt using PBKDF2

func EncryptAES

func EncryptAES(data []byte, password string) ([]byte, error)

EncryptAES encrypts data using AES-256-GCM with a password-derived key

func GenerateRandomBytes

func GenerateRandomBytes(length int) ([]byte, error)

GenerateRandomBytes generates random bytes of specified length

func GenerateSalt

func GenerateSalt() ([]byte, error)

GenerateSalt generates a random salt

func HashPassword

func HashPassword(password string) (string, error)

HashPassword hashes a password using bcrypt

func VerifyPassword

func VerifyPassword(password, hash string) bool

VerifyPassword verifies a password against its hash

Types

This section is empty.

Jump to

Keyboard shortcuts

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