internal

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SaltLength8  = 8 // size also used by OpenSSL, but 16 is also common
	SaltLength16 = 16
	SaltLength24 = 24
	SaltLength32 = 32
)

Variables

This section is empty.

Functions

func DecodeBase32

func DecodeBase32(encoded string) ([]byte, error)

Base32 decoding (only uppercase, no special characters)

func DecodeBase62

func DecodeBase62(encoded string) ([]byte, error)

Base62 decoding

func DecodeBase64

func DecodeBase64(encoded string) ([]byte, error)

Base64 decoding

func DecodeBase64Url

func DecodeBase64Url(encoded string) ([]byte, error)

Base64 decoding (URL safe variant)

func DecodeHex

func DecodeHex(encoded string) ([]byte, error)

Hex decoding

func DecryptAes

func DecryptAes(data []byte, key *Key) ([]byte, error)

func DecryptSecretbox

func DecryptSecretbox(data []byte, key *Key) ([]byte, error)

func DecryptXChaPo

func DecryptXChaPo(data []byte, key *Key) ([]byte, error)

func EncodeBase32

func EncodeBase32(data []byte) string

Base32 encoding (only uppercase, no special characters)

func EncodeBase62

func EncodeBase62(data []byte) string

Base62 encoding

func EncodeBase64

func EncodeBase64(data []byte) string

Base64 encoding

func EncodeBase64Url

func EncodeBase64Url(data []byte) string

Base64 encoding (URL safe variant)

func EncodeHex

func EncodeHex(data []byte) string

Hex encoding

func EncryptAes

func EncryptAes(data []byte, key *Key) ([]byte, error)

AES-256-GCM (~ AES-CTR-GMAC)

func EncryptSecretbox

func EncryptSecretbox(data []byte, key *Key) ([]byte, error)

XSalsa20-Poly1305

func EncryptXChaPo

func EncryptXChaPo(data []byte, key *Key) ([]byte, error)

XChaCha20-Poly1305

func NewSalt

func NewSalt(length int) []byte

func Unwrap

func Unwrap(text string) string

func Wrap

func Wrap(text string, length int) string

Types

type BoxKeyPair

type BoxKeyPair struct {
	PrivateKey [32]byte
	PublicKey  [32]byte
}

type BoxKeys

type BoxKeys struct {
	OwnPrivateKey  [32]byte
	OtherPublicKey [32]byte
	Nonce          [24]byte
}

type Key

type Key struct {
	// contains filtered or unexported fields
}

func DeriveKeyArgon2id

func DeriveKeyArgon2id(password []byte, salt []byte) *Key

func DeriveKeyHkdf

func DeriveKeyHkdf(password []byte, salt []byte) *Key

derive key using HKDF with SHA-256

func DeriveKeyPbkdf

func DeriveKeyPbkdf(password []byte, salt []byte) *Key

derive key using PBKDF2 with SHA-256

func DeriveKeyScrypt

func DeriveKeyScrypt(password []byte, salt []byte) *Key

Jump to

Keyboard shortcuts

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