aes

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SaltSize   = 16     // 盐值长度(字节)
	NonceSize  = 12     // IV/Nonce 长度(字节)
	KeySize    = 32     // AES-256
	PBKDF2Iter = 100000 // PBKDF2 迭代次数
)

Variables

This section is empty.

Functions

func DecryptGCM added in v0.1.4

func DecryptGCM(password string, ciphertextBase64 string) (string, error)

DecryptGCM 解密函数,根据 Base64 密文恢复明文

func DeriveKey added in v0.1.4

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

DeriveKey 使用 PBKDF2 从密码和盐值派生密钥

func EncryptGCM added in v0.1.4

func EncryptGCM(password string, plaintext string) (string, error)

EncryptGCM 加密函数,自动生成盐值和 nonce

Types

This section is empty.

Jump to

Keyboard shortcuts

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