crypt

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SaltSize   = 32         // in bytes
	NonceSize  = 24         // in bytes. taken from aead.NonceSize()
	KeySize    = uint32(32) // KeySize is 32 bytes (256 bits).
	KeyTime    = uint32(5)
	KeyMemory  = uint32(1024 * 64) // KeyMemory in KiB. here, 64 MiB.
	KeyThreads = uint8(4)
)

XChaCha variables

View Source
var (
	// MethodsAvailable is a list of available methods
	MethodsAvailable = []string{"aes", "aes256", "chacha20", "chacha20poly1305", "none"}
)

Functions

func AESDecrypt

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

AESDecrypt returns decrypted data and errors

func AESEncrypt

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

AESEncrypt returns encrypted data and errors

func AESVerifyKey

func AESVerifyKey(key, data []byte) (bool, error)

AESVerifyKey verify the password

func ChaCha20Decrypt

func ChaCha20Decrypt(key, data []byte) ([]byte, error)

ChaCha20Decrypt decrypts data with ChaCha20 Poly Algorithm and returns decrypted data and errors

func ChaCha20Encrypt

func ChaCha20Encrypt(key, data []byte) ([]byte, error)

ChaCha20Encrypt encrypts data with ChaCha20 Poly Algorithm and returns encrypted data and errors

func ChaCha20VerifyKey

func ChaCha20VerifyKey(key, data []byte) (bool, error)

ChaCha20VerifyKey verify the password

func Decrypt

func Decrypt(data []byte, algorithm string, key []byte) ([]byte, error)

Decrypt decrypts data with given algorithm and returns decrypted data and errors

func Encrypt

func Encrypt(data []byte, algorithm string, key []byte) ([]byte, error)

Encrypt encrypts data with given algorithm and returns encrypted data and errors

func VerifyKey

func VerifyKey(data []byte, algorithm string, key []byte) (bool, error)

VerifyKey verify the password

Types

This section is empty.

Jump to

Keyboard shortcuts

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